AnsweredAssumed Answered

USB Generic HID Device Example Code - Why is this "send" embedded in the receive function?

Question asked by Nick Guzzardo on Sep 28, 2018
Latest reply on Oct 26, 2018 by Nick Guzzardo

I'm using the LPCXpresso54608 SDK for MCUXpresso.  In particular, I'm running the generic HID device with FreeRTOS example code (link to my code/setup).

 

The purpose of the code is to echo data sent from a PC program back to the PC.  This all works as intended, but now I'm trying to modify it for my specific application needs.

 

In the function "USB_DeviceHidGenericCallback", the switch/case called after receiving a USB message includes a call to "USB_DeviceHidSend" which performs the echo function ... so far so good.  After that, within the same switch/case "USB_DeviceHidRecv" which eventually calls "USB_DeviceLpc3511IpRecv" which is the device specific call for the LPCXpresso54608 development board ... again, so far so good.  But then, within "USB_DeviceLpc3511IpRecv", the only function is to call "USB_DeviceLpc3511IpSend".

 

usb_status_t USB_DeviceLpc3511IpRecv(usb_device_controller_handle controllerHandle,

                                     uint8_t endpointAddress,

                                     uint8_t *buffer,

                                     uint32_t length)

{

    return USB_DeviceLpc3511IpSend(controllerHandle, endpointAddress, buffer, length);

// Example code echo data???  NBG

//    return kStatus_USB_Success;

}

 

My initial thought was that this was simply an accidental redundant means of echoing the received data, but when it is called, no data is received by the PC.  I attempted to replace the call with a return of the enumerated value for a successful USB operation, but then the ENTIRE PROGRAM STOPPED FUNCTIONING AND I HAVE NO IDEA WHY!!!

 

If anyone knows what the purpose is for the send within the receive shown above, please let me know.

 

Thank you in advance!

Outcomes