AnsweredAssumed Answered

CubeMx USB CDC asynchronous API?

Question asked by adib on May 24, 2015
Latest reply on Nov 25, 2015 by bauch.aaron.001
Hello All,

1) how can I have an asynchonous Transmit command ?
2) what is the largest amount of data I can put into CDC_Transmit_FS ?

I am implementing CDC on my firmware based on CubeMx. So far it works (I have to increase the heap)

when I quickly want to transmit severel chunks of data:
     CDC_Transmit_FS(buffer1, strlen((char *)buffer1));
     CDC_Transmit_FS(buffer2, strlen((char *)buffer2));
     CDC_Transmit_FS(buffer3, strlen((char *)buffer3));
only the first one is sent.

What I do not understand is how buffer handling is done.
in CDC_Transmit_FS it
a) USBD_CDC_SetTxBuffer
b) USBD_CDC_TransmitPacket
Function a) copies the buffer pointer to the HAL and function b) sends the data via USB.

Why does a second call of CDC_Transmit_FS does not overwrite data of the ongoing CDC_Transmit_FS?
What is a safe time to call CDC_Transmit_FS? Do I have to check before?

Is there a callback that tells me when CDC is ready for next call CDC_Transmit_FS?

How does CDC_Transmit_FS large amount of data?
Does it sent all data or only the first part that fits into USB CDC packet?

Regards, Adib.

Outcomes