Where can I find the number of bytes actually transferred as the result of calling USB_HostCdcDataSend and USB_HostCdcDataRecv? I’m not able to locate this information in the MCUXpresso SDK USB Stack Host Reference Manual.
Hello Jeff,
Can you please provide the MCU that you are using so I can check it with detail.
In the meanwhile, I checked with one I have handy and there is a parameter of the transfer, that is
transfer->transferSofar, in the USB Host transfer structure.
If you check within the function you are describing within, there is another function using USB_HostSend.
For this you pass the initializing parameters of the transfer, but you may add in a variable to check how many were transferred so far before the funciton returns.
Best Regards,
Sabina
Thanks, Sabrina. I'm using MCUXpresso 11.01 for the MIMXRT1062DVJ6A, and MCUXpresso SDK USB Stack, Rev. 10, 06/2019.
Jeff Thompson | Senior Electrical Engineer-Firmware
+1 704 752 6513 x1394
I think I found the answer. USB_HostCdcDatOutPipeCallback and USB_HostCdcDataInPipeCallback are called when the respective transfer completes. They, in turn, call the function the user specified as the callback to USB_HostCdcDataSend or USB_HostCdcDataRecv, supplying the callback argument the user specified, plus a pointer to the transferred data buffer, the number of bytes transferred, and the status. The USB stack document does not describe this, but reading through the source code does reveal the machinations.