USB Generic HID example program setup

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

USB Generic HID example program setup

跳至解决方案
3,038 次查看
nbgatgi
Contributor IV

The USB Generic HID example program receives data via USB device port and echoes that data back on the same port.  I have used this program successfully with the LPCXpresso54608 eval board using the high-speed (HS) PHY.  We have since decided to move the the i.MX RT1064 MCU.  To make a clean transition, I need to reproduce my test results from the LPCXpresso54608 on the MIMXRT1064-EVK.

I was able to download and install the SDK into MCUXpresso v10.3 and create the generic HID with FreeRTOS example code project which was nearly identical with the exception of processor specific items.  For the LPC project, I modified it to more closely represent our intended use case.  Aside from a dummy RTOS task and simple data manipulation, the USB related changes were to configure the MCU to us the HS PHY and increase the packet size to 1024 bytes.

For both projects, the file usb_device_config.h was identical with the exception of some comments at the beginning regarding copyright.  Here are the original 4 configuration definitions:

/*! @brief KHCI instance count */
#define USB_DEVICE_CONFIG_KHCI (0U)

/*! @brief EHCI instance count */
#define USB_DEVICE_CONFIG_EHCI (1U)

/*! @brief LPC USB IP3511 FS instance count */
#define USB_DEVICE_CONFIG_LPCIP3511FS (0U)

/*! @brief LPC USB IP3511 HS instance count */
#define USB_DEVICE_CONFIG_LPCIP3511HS (0U)

Note that the stack has been configured to be and enhanced host controller interface (EHCI), but since this project is intended to be a HS device (not host), I changed the configuration to the following:

/*! @brief KHCI instance count */
#define USB_DEVICE_CONFIG_KHCI (0U)

/*! @brief EHCI instance count */
#define USB_DEVICE_CONFIG_EHCI (0U)

/*! @brief LPC USB IP3511 FS instance count */
#define USB_DEVICE_CONFIG_LPCIP3511FS (0U)

/*! @brief LPC USB IP3511 HS instance count */
#define USB_DEVICE_CONFIG_LPCIP3511HS (1U)

This is the configuration that worked in my LPC project.  This definition leads to a variety of configuration specific initializations and function calls being enabled through compiler directives which leads to my question/concern.

In the LPC project there were several compiler directives that clearly separated EHCI from HS-device (LPCIP3511HS) configurations.  In the i.MX project it seemed to only have options for EHCI.

1)  Has anyone attempted to use the generic HID example program successfully?

2)  If so, did you have to make modifications in the file hid_generic.c to exclude EHCI function and include HS device function via the OTG PHYs?

标签 (4)
1 解答
2,531 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Nick Guzzardo

Enhanced host controller interface (EHCI) included drivers for Host and Device USB 2.0 standard, which included High speed. Please use,

#define USB_DEVICE_CONFIG_EHCI (1U)


RT1064 uses those drivers not the LPC ones.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

在原帖中查看解决方案

4 回复数
2,532 次查看
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Nick Guzzardo

Enhanced host controller interface (EHCI) included drivers for Host and Device USB 2.0 standard, which included High speed. Please use,

#define USB_DEVICE_CONFIG_EHCI (1U)


RT1064 uses those drivers not the LPC ones.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

-------------------------------------------------------------------------------

2,531 次查看
nbgatgi
Contributor IV

Jorge,

I replied asking a question about a month ago.  Would you have a moment to review and respond?

Nick

0 项奖励
2,531 次查看
nbgatgi
Contributor IV

Trusting that whomever set up the example code in the SDK, I left it configured for EHCI.  I imported all my device agnostic code and it worked as it did with my LPC54608 eval board including the race-condition lock-up (inherent to SDK, not my custom code).  The fix required for the LPC54608 also worked with the RT1064 so that was a relief!

Jorge - Do you specialize in the i.MX RT family of processors or something else?  I'm asking because I want to make sure someone at NXP notes that there is a fundamental problem with the USB stack provided (race condition mentioned above).  I didn't come up with the solution.  Someone else posted the fix in the forum, though I have lost the link.  I was hoping it would be corrected in the next SDK version to save others from running into the same thing.

0 项奖励
2,111 次查看
BenDev
Contributor II

Hi nbgatgi,

Appologies for reviving this old thread but what race-condition are you talking about in this post? What was the fix for the LPC54608?

Cheers

0 项奖励