I am running the generic HID device code from the MCUXpresso SDK for the LPCXpresso54608 evaluation board. I have modified the code to use the high-speed (HS) PHY and transmit 1024 byte packets. The example code function receives data from a Windows C# program and echoes it back to be displayed on the PC. The details of the PHY and packet size change as well as the C# code are located here.
Now, I need to take the example code and modify it to directly control data transfers from a custom application. As I have never worked with this or any other USB stack prior to this project, and with the example code documentation limited, I am struggling to determine the highest level by which to initiate sending data and respond to received data.
After much time looking through several "Call Hierarchies" I found the following suspect send/receive pairs:
- USB_DeviceLpc3511IpSend / USB_DeviceLpc3511IpRecv
- USB_DeviceHidSend / USB_DeviceHidRecv
I am not sure if the above pairs are interconnected or independent.
I also found a @brief for USB_DeviceLpc3511IpEndpointPrime that states "Write the command/status entry to start a transfer", but looking for calls seems to lead me in circles.
What I need to accomplish in the end is not very complicated (for now).
1) see when data has been received from the host and manipulate that data
2) load data to be sent to the host and initiate the send request for the next host polling time slot
I emphasized the "for now" because we are not interested in doing this as a virtual com port so I respectfully request that you avoid VCOM related proposals and questions. HID was chosen due to the readily available drivers and the guaranteed latency and bandwidth of interrupt transfers. Down the road we intend to create custom report descriptors, but I digress.
The example code for the generic HID device is nearly identical for other dev boards covered in the MCUXpresso SDKs, so if you have a different LPC or Kinetis part, get the appropriate SDK and you should be able to duplicate what I'm doing.
Note also that my example code is running under FreeRTOS also not by accident. I don't have much experience with it, but it is the OS we have used with other recent platforms here. That said, if you are able to offer help under the bare-metal example code, I would bet it would still be helpful.
Thank you for any help you can provide!