USB Generic HID example program setup

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB Generic HID example program setup

Jump to solution
3,875 Views
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?

Labels (4)
1 Solution
3,368 Views
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!

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

View solution in original post

4 Replies
3,369 Views
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!

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

3,368 Views
nbgatgi
Contributor IV

Jorge,

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

Nick

0 Kudos
Reply
3,368 Views
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 Kudos
Reply
2,948 Views
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 Kudos
Reply