完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我遵循了Help帮助文档的USB库部分中的指令来创建USB设备。但是,我的AppUsBeDeVice EnEnthDeLeR()函数没有接收到任何回调——我已经通过在它的开头放一行代码来验证它来切换一个LED,而且它永远不会发生。下面是我设置的代码:在用PIC设备运行代码时(PIC32 MX530F自定义板)128L)连接到我的电脑,我的电脑做USB声音,并提出了一个“设备不承认”错误。这是意料之中的,因为我还没有真正开始编写我打算使用的USB实现(MIDI)。但是,即使没有调用AppUsBeDeVestEnEnthDrand(),即使对于UBS.DeVice,EnvivPosil检测到的事件,我也无能为力。谁能看出我出了什么问题?
以上来自于百度翻译 以下为原文 I've followed the instructions in the USB Libraries section of the HARMony Help document to create a USB device. However, my APP_USBDeviceEventHandler() function is not receiving any callbacks - I've verified this by putting a line of code at the start of it to switch an LED on, and it never happens. Here's the code with which I set it up: void APP_Tasks(void) { /* Check the application's current state. */ switch (appData.state) { /* Application's initial state. */ case APP_STATE_INIT: { // Open the device layer u***DeviceHandle = USB_DEVICE_Open(USB_DEVICE_INDEX_0, DRV_IO_INTENT_READWRITE); if (u***DeviceHandle != USB_DEVICE_HANDLE_INVALID) { // Register a callback with device layer to get event notification USB_DEVICE_EventHandlerSet(u***DeviceHandle, APP_USBDeviceEventHandler, 0); appData.state = APP_STATE_SERVICE_TASKS; USB_DEVICE_Attach(u***DeviceHandle); } else { // The Device Layer is not ready to be opened. We should try // gain later. } break; } case APP_STATE_SERVICE_TASKS: { break; } /* TODO: implement your application state machine.*/ /* The default state should never be executed. */ default: { /* TODO: Handle error in application's state machine. */ break; } } } Upon running the code with the PIC device (custom board with PIC32MX530F128L) connected to my computer, my computer makes the USB sound, and comes up with a "device not recognized" error. That's expected, as I haven't really begun writing the USB implementation I intend to use (MIDI). However, with APP_USBDeviceEventHandler() not being called, even for the USB_DEVICE_EVENT_POWER_DETECTED event, there's not much I can do. Can anyone see where I'm going wrong? |
|
相关推荐
10个回答
|
|
PIC的VBUS引脚连接到USB连接器上的VBUS引脚吗?你看到这个针有5V了吗?
以上来自于百度翻译 以下为原文 Is the VBUS pin of PIC connected to the VBUS pin on the USB connector? Are you seeing 5V at this pin? |
|
|
|
|
|
|
|
这仍然让我完全陷入困境-我复制了和谐鼠标示例的代码到Meal.C和Ma.h文件,而AppUsBeDeVeEvEnthand()仍然没有被调用。我确信我的振荡器已经正确设置了。我告诉过和声。我一直在做的其他代码在PIC芯片上运行得很好,不幸的是,看起来我可能不得不降级该项目来使用MLA的PIC24。
以上来自于百度翻译 以下为原文 This still has me completely stumped - I copied the code for the Harmony mouse example into main.c and main.h files, and APP_USBDeviceEventHandler() still isn't being called ever. I'm quite sure I've got my oscillators set up correctly - I'm using an 8MHz crystal for my primary oscillator, which is what I've told Harmony. Other code I've been working on is running fine on the PIC chip. At this rate, unfortunately, it's looking like I might have to downgrade the project to use a PIC24 with the MLA. |
|
|
|
有没有机会运行基本的计算机端口示例?这样你就可以验证硬件是正确的。我不会降级到PIC24和MLA。我发现PIC32芯片和USB在和谐中得到了很好的支持。
以上来自于百度翻译 以下为原文 Any chance you can run the basic computer port example? That way you can verify that the hardware is correct. I wouldn't downgrade to a PIC24 and the MLA. I have found the PIC32 chips and USB to be fairly well supported in Harmony. |
|
|
|
如果你有预算,就可以使用一个Microchip EVE板,这样你就可以完成硬件和软件。
以上来自于百度翻译 以下为原文 If you have the budget it is handy to have a microchip eval board so you can complete the hardware and software. |
|
|
|
谢谢你的回复。我在哪里可以找到基本的计算机端口示例?
以上来自于百度翻译 以下为原文 Thanks for the replies. Where would I find the basic computer port example? |
|
|
|
仍然不确定如何向前推进。买一个评估板是答案,所以我可以验证代码是否正确,然后开始调查我的棋盘可能有什么问题?它肯定听起来好像我没有错过任何软件明智?是否有任何额外的步骤,我错过了,以便得到thappaUbServices EvEnthalLe()调用来?
以上来自于百度翻译 以下为原文 Still unsure how to move forward on this. Would buying an evaluation board be the answer, so I can verify that the code works correctly on that first, then start investigating what could be wrong with my board? Does it definitely sound like I'm not missing anything software-wise? Could there be any additional steps I'm missing in order to get those APP_USBDeviceEventHandler() calls coming? |
|
|
|
嗨,最和谐的成功路径确实是使用尽可能接近你的木板的微型芯片演示板,以确保盒子外的例子如预期的那样工作。然后你有一个参考平台,你可以实验改变。从那里你也可以把端口移植到你自己的硬件平台上,你肯定会知道,如果它不工作,意味着移植不正确。PIC32最靠近的板可能是PIC32 MX1/2/5启动器套件。有一个美国。B为该板的例子:C:Microchip 和谐 V2Y04AppUSB设备CDCJMSDBASE
以上来自于百度翻译 以下为原文 Hi, The most successful path to Harmony is indeed to use a microchip demoboard as close as possible to your board to ensure out of the box examples work as expected. Then you have a reference platform and you can experiment changes. From there you can also port to your own hardware platform and you'll know for sure that if it does not work it means the porting is not correct . The closest board to you PIC32 is probably the PIC32MX1/2/5 starter kit. There is one USB example for that board : c:microchipharmonyv2_04appsu***devicecdc_msd_basic Regards |
|
|
|
你能检查一下USB中断优先级是否被配置为0以外的任何东西?在添加的系统中还有其他的中断吗?您还可以检查是否正确配置了UBPLL来生成48兆赫。
以上来自于百度翻译 以下为原文 Could you check if the USB interrupt priority is configured to be anything other than 0? Are there any other interrupts in the systems that have been added? Could you also check if the USBPLL is configured correctly to generate 48MHz. |
|
|
|
它在工作!对不起,PLL没有正确设置。我错误地认为和声告诉我这一切都是自动配置的。
以上来自于百度翻译 以下为原文 It's working! I'm so sorry, the PLL was not set up correctly. I mistakenly thought that Harmony was telling me it was all automatically configured. |
|
|
|
只有小组成员才能发言,加入小组>>
4814 浏览 9 评论
1823 浏览 8 评论
1743 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2949 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2055 浏览 5 评论
452浏览 1评论
1107浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
355浏览 0评论
260浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1777浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-19 16:11 , Processed in 1.224433 second(s), Total 78, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号