USB HOST CDC—Number of bytes actually transferred

cancel
Showing results for 
Search instead for 
Did you mean: 

USB HOST CDC—Number of bytes actually transferred

314 Views
jeffthompson
Contributor V

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.

0 Kudos
3 Replies

151 Views
Sabina_Bruce
NXP Employee
NXP Employee

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

0 Kudos

151 Views
jeffthompson
Contributor V

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

www.invue.com

0 Kudos

151 Views
jeffthompson
Contributor V

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.

0 Kudos