USB HOST CDC—Number of bytes actually transferred

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

USB HOST CDC—Number of bytes actually transferred

2,351 次查看
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.

标记 (2)
0 项奖励
回复
3 回复数

2,188 次查看
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 项奖励
回复

2,188 次查看
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 项奖励
回复

2,188 次查看
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 项奖励
回复