完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我开始研究和声和PIC32。我有一个PIC32 ESK II,我正在练习它。我有和声V1.10,我玩了一些示例代码,它工作得很好。现在我试图在BSP文件的帮助下创建一个项目,就像我从头开始启动一个硬件项目一样。我做的第一件事是玩PLBIX端口和板发光二极管,很好。然后我玩计时器,创建两个计时器中断来改变LED,也很好。我现在正试图让USB端口工作。我想做的是让USB作为CDC工作,因为它很容易用串行终端仿真器与固件进行交互。我做的第一件事是为USB SK2打开示例代码,CDC*COMLPORtiONSOUNT。演示代码工作得很好。我花了一些时间试图理解代码,状态机是如何工作的,我有点理解它。然后我尝试在我的项目上启用USB端口。我遵循了演示代码的所有配置,并应用到我的代码中,复制了状态机,但是USB没有出现在计算机上。我做了一个测试,我把BSP加载到我的项目上,用于USB SK2,然后USB在计算机上工作。我搜索了BSP不同于我对项目的配置,但是我找不到它。我想知道是否有人能帮助我找出我的代码有什么问题,如果需要的话,我可以把项目上传到某个地方,我只是不知道该去哪里寻找。可能是一个简单的错误,但因为我是新的PIC32和和谐,这对我来说是非常困难的。谢谢任何帮助!
以上来自于百度翻译 以下为原文 Hello I'm starting to study about HARMony and PIC32. I have a PIC32 ESK II and I'm practicing with it. I have Harmony v1.10, and I played with some example code, and it worked fine. Now I'm trying to create a project without the help of the BSP file, like if I was starting a hardware project from scratch. The first thing I did was playing with PLIB_PORTS and the board LEDs, just fine. Then I played with Timer and created two Timers interrupts to change the LEDs, just fine too. I'm stuck now trying to make the USB port to work. What I would like to do is to make the USB work as a CDC, because it makes it very easy to interact with the firmware using a serial terminal emulator. The first thing I did was to open the example code for USB SK2, cdc_com_port_single. The demo code worked just fine. I spent some time trying to understand the code, how the state machine works, and I kinda understood it. I then tried to enable the USB port on my project. I followed all the configs the demo code have, and applied to my code, copyed the state machine, but the USB does not appear on the computer. I made a test, I loaded the BSP on my project for USB SK2, and then the USB worked on the computer. I searched for what the BSP is different from the configuration I made to my project, but I can't find it. I would like to know if somebody could help me finding what's wrong with my code, if needed I can upload the project somewhere, I simply doesn't know where to look for it. Probably is a simple mistake, but as I'm new to PIC32 and Harmony, this is getting very hard to me. Thanks for any help! |
|
相关推荐
10个回答
|
|
|
我对此表示怀疑。我已经解构了USB CDC双端口演示,它并不简单。首先,您需要为USB设备层中创建的UBSDEVICESIO事件创建一个UbDeVice EvestHANDER。接下来,您需要为CDC事件创建UBSDEVICEXECCDCYESTYROR响应事件处理程序。这两个事件处理程序都可以在应用程序级数据对象中设置数据。最后,状态机对数据对象设置起作用。演示应用程序中使用的AppDATA对象在使用多个模块时变得难以管理。我创建了一个单独的UBSCDC状态机。这些状态是从演示代码中派生出来的。这花了一段时间,但最终我得到了所有的工作。你也一样。祝你好运。
以上来自于百度翻译 以下为原文
|
|
|
|
|
|
感谢您的答复,我所做的是运行一个单一的CDC端口的示例代码,它做得很好,然后我尝试创建另一个项目,使用相同的配置(我发现),和相同的例程。因此,我为UsBeDeVeEvEntDeLeer-Stand机器以及U***DeVeCeCdEvEndEnder-Read做了一个拷贝和粘贴。据我所知,UsBeDeVice EvEnthanDeLtEnter机为UbDeVeCeCdCeEvEndDanager提供了一个处理程序。奇怪的是,当我尝试运行代码时,计算机并没有将该板显示为设备管理器上的COM端口,但是如果我检查“使用BSP”选项,它运行得很好。所以,它可能是BSP定义上的一个配置,我没有在这个项目上做过,但是我找不到它可能是什么…我不知道该去哪里寻找,如果有人给我小费,我会非常感激……最好的问候!
以上来自于百度翻译 以下为原文 Thank for your reply What I did was to run the example code for a single CDC port, which did fine, then I tried to create another project, using the same configuration (that I found), and the same routines. So, I did a copy and paste for the USBDeviceEventHandler state machine, as well as the USBDeviceCDCEventHandler. As far as I could understand, the USBDeviceEventHandler state machine stes the handler for the USBDeviceCDCEventHandler. What is strange is that when I try to run the code, the computer doesn't show the board as a COM port on the Device Manager, but if I check the "Use BSP" option, it runs nicely. So, it probably is a configuration on the BSP definition that I did not made on the project, but I cannot find what could it be... and I don't know where to look for it. If someone have a tip for it, I will highly appreciate it... Best regards! |
|
|
|
|
|
有趣的是,我检查了我的BSP配置,注意到在BSP.H和TSP.C中有与USB VBUS相关的功能。然而,我总是尝试使用最小数量的和谐/MHC设置,所以我检查了我的DEVCFG3,我有USB VBUS设置关闭。我的假设是不使用BSP代码(但这可能是一个坏的假设)。你的DEVCFG3设置是什么?
以上来自于百度翻译 以下为原文 Interesting... I checked my BSP configuration and noticed that in bsp.h and tsp.c there are functions related to the USB VBUS. However, I always try to use the minimum number of Harmony/MHC settings so I checked my DEVCFG3 and I have the USB VBUS setting turned OFF. My assumption is that the BSP code is not used (but that could be a bad assumption). What are your DEVCFG3 settings? |
|
|
|
|
|
V1.XX和声在BSP中具有USB功能。你需要把这些拷贝给你…不管你用什么来代替BSP
以上来自于百度翻译 以下为原文 The V1.XX harmony has USB Functions in the BSP. You would need to copy these to you... Whatever you are using in lieu of a BSP |
|
|
|
|
|
此外,USB双端口存储器必须为特定的内存区域定义,并且可能需要自定义链接器脚本。当我把Microchip PicDEM FS USB代码移植到我自己的项目中时,我遇到了这个问题,当我换成一个具有不同内存空间的设备(PIC18F2550与PIC18F44 50,IRC)时,我认为任何设备都有适当的硬件将被OS检测到,但是如果固件会出错。反应不正常。您可能需要搜索Device Mangler的“未知设备”,您也可以设置它为“查看隐藏设备”,它将显示那些没有连接的(或者OS没有看到)。我的经验主要是PIC18F2550和其他的系列,使用C18编译器。我想我最终还是和XC8一起工作了,但是这很困难,我不确定我做的改变是正确的和可靠的。我的PIC16F1455使用了最近的MLA演示板代码,我认为源文件有用于XC8和C18的有条件编译代码块,所以构建更加顺利。但是我认为从零开始构建USB项目可能是徒劳的。库文件是相当通用的,并且大多数代码是USB系统工作所必需的。
以上来自于百度翻译 以下为原文 Also, the USB dual-port memory must be defined for a specific area of memory, and may require a custom linker script. I had that problem when trying to port the Microchip PICdem FS USB code to my own project, when I changed to a device with different memory space (PIC18F2550 vs PIC 18F4450, IIRC). However, I think any device with the proper hardware will be detected by the OS, but will give an error if the firmware does not respond properly. You may need to search the Device Mangler for an "unknown device", and you might also set it for "view hidden devices" which will show those that are not connected (or that the OS does not see). My experience was mostly with the PIC18F2550 and others in that series, using the C18 compiler. I think I eventually got it to work with XC8, but it was difficult and I'm not sure the changes I made are correct and reliable. My PIC16F1455 used more recent MLA demo board code and I think the source files had conditional compiler code blocks for XC8 and C18, so the build went more smoothly. But I think it may be an exercise in futility to build a USB project "from scratch". The library files are fairly generic and most of the code is required for the USB system to work. |
|
|
|
|
|
你好BELPI注意到BSP文件上的那些功能。我找不到示例代码的任何地方,调用这些函数。有一个功能,使高VBUS引脚,我试图了解为什么,我最好能理解的是,这个引脚是用在USB主机模式,而不是在设备上。因此,在这个函数被调用的地方,我认为不把这个函数放在代码中是安全的。但是我可能错了…DeVCFG3是这样的:我试图从工作示例代码中复制它们,它们来自工作实例代码:如果你(或任何人)想看一看代码,它可以从http://www. Doffbox…com……RMONYY-TESTYAR2.RAR下载?DL= 0HTTPS://www. DROPBOX.COM/S/TE95YDTEYV0V6Z6/OrthyLyTestStI%2% 20 %-20COPIIA.RAR?dl=0.第一个是我正在尝试构建的代码,这是行不通的。第二个和第一个完全一样,但我只是检查了“使用BSP”选项,它是有效的。代码不能做任何有用的事情,只是在计算机上作为串行端口出现。该项目必须驻留在应用程序文件夹从和声1.10,我运行它在PIC32 ESK II。谢谢您的帮助,到目前为止!
以上来自于百度翻译 以下为原文 Hello BillP I noticed those functions on the BSP file. I could not find anywhere on the example code where such functions are called. There is one function that turns high the VBUS pin, I tried to understand why, and the best I could understand is that this pin is used in USB host mode, not on device. So, as nowhere this function is called, I tought that it might be safe to not put that function in my code. But I may be wrong... The DEVCFG3 are like that: I tried to copy them from the working example code #pragma config USERID = 0xffff #pragma config FSRSSEL = PRIORITY_7 #pragma config FMIIEN = ON #pragma config FETHIO = OFF #pragma config FCANIO = OFF #pragma config FUSBIDIO = OFF #pragma config FVBUSONIO = OFF If you (or anyone) wanna take a look at the code, it can be downloaded from: https://www.dropbox.com/s...rmony_Teste_2.rar?dl=0 https://www.dropbox.com/s/te95ydteyv0v6z6/Harmony_Teste_2%20-%20Copia.rar?dl=0 The first is the code I am trying to build, which doesn't work. The second one is exactly like the first, but I just checked the "Use BSP" option, and it works. The code doesn't do anything useful, the pourpose is only to appear on the computer as a serial port. The project must reside in the apps folder from harmony 1.10, and I'm running it on a PIC32 ESK II. Thank you for help so far! |
|
|
|
|
|
你好,保罗,我不清楚WAI的意思是“从头开始”。我的目的是建立一个项目,而不加载一个板支持包,就是这样。如果我用PIC32微控制器做了一个项目,为另一个板加载一个BSP没有多大意义,所以我想用一个初学者工具包(仅仅为了便于组装一个板)来构建一个项目,并使用所有的和声库来编写代码,而不是使用BSP来做。它,我复制了一些功能上的示例代码,我试图配置的PIC和和谐没有BSP的帮助,它没有工作,我找不到原因……在回答BILP答案,我把链接的项目,如果有人想尝试它,这将有助于我很多!
以上来自于百度翻译 以下为原文 Hello Paul Probably I wasn't clear about wha I mean with "from scratch". My intent is to build a project without loading a Board Support Package, just that. If I made a project using a PIC32 microcontroller, loading a BSP for another board doesn't make much sense, so I would like to build a project using a starter kit (just for the convenience of having an assembled board), and make the code using all the Harmony libraries, and not using the BSP. To do it, I copied some functions on the example code, and I tried to configure the PIC and Harmony without the help of the BSP, and it didn't work, and I can't find the reason for it... In reply for the BillP answer, I put the links for the project, if anyone wanna try it, that will help me a lot! |
|
|
|
|
|
嗨,XXULTZ,我在你发布的2个项目目录上做了一个WiDiff,唯一的差异在NBProject目录中。它显示了这些项目是在不同的MPLAX版本下运行的:可能性:我在最新的MPLAB X版本中有严重的问题,特别是使用USB COMM库。在MPLAX网站上甚至有一个下载解决方案,但它让我警惕应用程序中的任何USB问题。所以我把我的项目转换成了Mac,现在一切似乎都很好。请查看MPLAX论坛了解更多信息。我不能在我的系统上运行你的项目,因为我们有不同的硬件和和声版本。因此,我可以查看所有的源文件,并将其与我的项目进行比较,该项目还使用了我的以太网启动器工具包II的BSP选项(与您的CPU相同)。这是我从您的项目中的源代码对我的PRPPETE源代码文件.StultSuiIn.c:1的视觉审查中找到的。配置位是不同的,特别是时钟设置。但是,如果这些设置工作,它们对于BSP选项应该相同。但是,您可能需要尝试我的设置,看看结果是否有任何变化。** DeFCFG0**/*ApRigab-TracMIG-COMFIG调试= =关于AXSPLACMA配置文件ICSIL=ICSU-PGX2α-PrAPMA配置PWP=Off-TracMA配置文件BWP=Off-AX-PracMA配置Cp= OF/**DEVCFG1***/AX-PracMA配置FFNC=PrPrLL PrimaMatg配置FSOCEO=在X-TraceMatlab配置文件中,OXCIOMAGCOMIG-COMPIMACONFIGOFIMAG=FIMPODIG1,PFIDEMA=DIVIG1,PrimMa1,PracMeCo,FCKSM=CSEMME=PracMa配置,WDTPS=PS1048 57 6μ* Prima配置文件FWDTEN=OF/**DEVCFG2****/A*PrimaFig=FIPLIDEV=DIVIZ2O.PracMA配置FPLLMUL=Mule2020 TracMA配置FP n=关于α-PrimaMac配置1- PrimaMeqMaql2,PrimaMy2,Ap**DeFrg3********************************PrimFiff.Fr.Trima7。洛迪夫;编辑倍数>2。USB设备描述符设置是不同的,但应该是可以的。我使用双端口演示描述符。3。我的USB中断优先级设置为Leave1,SuiSuPrRyTyIsLealIO.0。不知道这是否有任何影响。我怀疑这一点。我有一些更多的包含文件,但不应该是。App.C1。唯一的“奇怪”代码是在USB设备事件处理程序中,CASE=UBS.DeVice。在ChannLyd上有一个调用PLIB PosisSpPoSET的线路。我假设是用一个LED来显示你执行了那个案例。现在对于混乱的信息:我能够破解我的项目,这样我就可以检查和取消检查“使用BSP”选项。我首先删除了我的App.c中所有的LED和开关的引用,所以程序将编译和加载。我可以看到我的Mac上CoolTerm上出现了港口。接下来,我取消了“使用BSP”选项,重新编译并重新加载,CoolTerm上没有出现端口。所以我看到了你做过的同样的事情(我想我还是这样做了)。我把问题追溯到MHC,把我的时钟设置在DeVCFG1中变成了我不认识的东西。这是MHC中的一个缺陷,应该报告给Microchip。当我将DEVCFG1重置为正确的设置时,生成一个新的库,编译并重新加载,串行端口出现在CaleTalk上。注意:它确实需要了几个电源周期和重试才能使它正确,但我能够检查和取消检查BSP选项并使应用程序工作。现在是坏消息。我重新检查了您的两个项目配置设置,AMD对于两个项目都是相同的,所以我仍然不知道是什么导致了您的问题。对不起的。如果我相信我的电脑,我可以尝试在PC(Windows 10)上复制所有这些,但我想你可能想先看看这个帖子。-比利
以上来自于百度翻译 以下为原文 Hi xxultz, I did a WinDiff on the 2 project directories you posted and the only differences were in the nbproject directory. It showed these projects were run under different MPLAB X versions. Possibility: I have had serious problems with the latest MPLAB X versions specifically with the USB comm libraries. There is even a download fix on the MPLAB X website, but it made me wary of any USB problems in the application. So I switched my project to a MAC and everything seems OK now. Check the MPLAB X forum for more info on this. I could not run your project on my system because we have different hardware and Harmony versions. So I could view all the source files and compare them to my project which also used the bsp option for my Ethernet Starter Kit II (same CPU as yours). Here is what I found from my visual review of the source code in your project vs. my prpject source code files. system_init.c: 1. The configuration bits are different, especially the clock settings. However, if these settings work, they should be the same for either bsp option. However, you might want to try my settings to see if there is any change in the results. *** DEVCFG0 ***/ #pragma config DEBUG = ON #pragma config ICESEL = ICS_PGx2 #pragma config PWP = OFF #pragma config BWP = OFF #pragma config CP = OFF /*** DEVCFG1 ***/ #pragma config FNOSC = PRIPLL #pragma config FSOSCEN = ON #pragma config IESO = ON #pragma config POSCMOD = XT #pragma config OSCIOFNC = OFF #pragma config FPBDIV = DIV_1 #pragma config FCKSM = CSECME #pragma config WDTPS = PS1048576 #pragma config FWDTEN = OFF /*** DEVCFG2 ***/ #pragma config FPLLIDIV = DIV_2 #pragma config FPLLMUL = MUL_20 #pragma config FPLLODIV = DIV_1 #pragma config UPLLIDIV = DIV_2 #pragma config UPLLEN = ON /*** DEVCFG3 ***/ #pragma config USERID = 0xffff #pragma config FSRSSEL = PRIORITY_7 #pragma config FMIIEN = OFF #pragma config FETHIO = OFF #pragma config FCANIO = OFF #pragma config FUSBIDIO = OFF #pragma config FVBUSONIO = OFF // 2. The USB device descriptor settings are different, but that should be OK. I am using the dual port demo descriptors. 3. My USB interrupt priority is set to LEVEL_1, SUB_PRIORITY_LEVEL_0. Don’t know if that has any effect here. I doubt it. app.h 1. I have a few more include files, but that should not matter. app.c 1. The only "strange" code was in the USB device event handler, case = USB_DEVICE_EVENT_CONFIGURED. There is a line calling PLIB_PORTS_PinSet on CHANNEL_D. I assume that was to light an LED to show that you executed that case. Now for the confusing info: I was able to hack my project so I could check and uncheck the “use BSP” option. I first removed all the references to the LEDs and switches in my app.c so the program would compile and load. I could see the ports show up on CoolTerm on my MAC. Next, I unchecked the “use BSP” option, recompiled and reloaded and the ports did NOT appear on CoolTerm. So I saw the same thing you did (I think I did anyway). I traced the problem to MHC changing my clock settings in DEVCFG1 to something I did not recognize. This is a bug in MHC and should be reported to Microchip. When I reset DEVCFG1 to the correct settings, generated a new library, compiled and reloaded, the serial ports showed up on CoolTerm. Note: it did take a few power cycles and retries to get it right, but I was able to check and uncheck the BSP option and have the application work. Now the bad news. I rechecked your two project configuration settings amd they are the same for both of your projects, so I still do not know what is causing your problem. Sorry. If I trusted my PC, I could try to reproduce all of this on the PC (Windows 10), but I thought you might want to see this posting first. -BillP |
|
|
|
|
|
你好,BillP!非常感谢你的帮助和回复!它帮助了我很多,结果发现问题在于配置位的不同。正如你指出的,在那里有一些差异,并在改变配置位,使两者完全相同,串行端口出现在设备管理器!我试着理解为什么我犯了那个愚蠢的错误。我想(稍后我会检查),当我检查BSP选项时,MHC没有更新配置位,也许我需要关闭并重新打开它。这是奇怪的,因为我关心复制配置位(我拍了他们的截图来设置它们)。在经历了这个问题之后,它让我害怕如何使设备和谐。也许我是天真的,但如果MHC帮助它会很好,比如,如果我检查使用USB端口,它应该显示哪些其他配置必须做(或自动地)使它工作。无论如何,非常感谢你的帮助!!!!!!!
以上来自于百度翻译 以下为原文 Hello BillP! Thank you so so so so much for your help and your reply! It helped me a lot. It turns out that the problem was with differences in the configuration bits. As you pointed, there where some differences, and after changing the configuration bits to make both exactly the same, the serial port appeared on the Device Manager! I'm trying to understand why I made that silly mistake. I think (I will check later) that when I check the BSP option the MHC does not update the configuration bits, maybe I need to close and reopen it. It is odd because I take care of copying the configuration bits (I took screenshots of them in order to set them). After struggling with that problem, it scares me about how complicated it is to make the devices work on Harmony. Maybe I'm naïve, but it would be great if MHC helped with it, like, if I check to use the USB port, it should show which other configuration must be done (or do it automagically) to make it work. Anyway, thank you so much for your help!!!!! |
|
|
|
|
|
你好,BillP!非常感谢你的帮助和回复!它帮助了我很多,结果发现问题在于配置位的不同。正如你指出的,在那里有一些差异,并在改变配置位,使两者完全相同,串行端口出现在设备管理器!我试着理解为什么我犯了那个愚蠢的错误。我想(稍后我会检查),当我检查BSP选项时,MHC没有更新配置位,也许我需要关闭并重新打开它。这是奇怪的,因为我关心复制配置位(我拍了他们的截图来设置它们)。在经历了这个问题之后,它让我害怕如何使设备和谐。也许我是天真的,但如果MHC帮助它会很好,比如,如果我检查使用USB端口,它应该显示哪些其他配置必须做(或自动地)使它工作。无论如何,非常感谢你的帮助!!!!!!!
以上来自于百度翻译 以下为原文 Hello BillP! Thank you so so so so much for your help and your reply! It helped me a lot. It turns out that the problem was with differences in the configuration bits. As you pointed, there where some differences, and after changing the configuration bits to make both exactly the same, the serial port appeared on the Device Manager! I'm trying to understand why I made that silly mistake. I think (I will check later) that when I check the BSP option the MHC does not update the configuration bits, maybe I need to close and reopen it. It is odd because I take care of copying the configuration bits (I took screenshots of them in order to set them). After struggling with that problem, it scares me about how complicated it is to make the devices work on Harmony. Maybe I'm naïve, but it would be great if MHC helped with it, like, if I check to use the USB port, it should show which other configuration must be done (or do it automagically) to make it work. Anyway, thank you so much for your help!!!!! |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503 浏览 0 评论
5812 浏览 9 评论
2350 浏览 8 评论
2237 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3544 浏览 3 评论
1159浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1121浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
888浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
503浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-13 23:23 , Processed in 1.094071 second(s), Total 90, Slave 73 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2529