2015-05-24 09:38 AM
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. #cdc #stm32f4 #usb #cubemx2015-11-22 02:41 AM
Same question.
How to catch ''sent'' event?And for what is UserTxBufferFS when CDC_Transmit_FS never use it?2015-11-24 07:37 AM
Hipereslegin.dmitriy,
Refer to this and this , may be it can help. -Shahrzad-2015-11-25 10:00 AM
You need to check the status returned by the call to CDC_Transmit_FS(). It will return a status of HAL_OK if the transmitter is ready to accept the next message, but it will return not OK if it is still busy with the last message. So if you put your statement in a while loop that keeps retrying until it gets back HAL_OK, the subsequent messages will block until they can be sent, and then they will go out in the order you send them.