2019-01-16 03:06 AM
Hello,
Using CubeMX, I have created USB CDC device for FS and started using the CDC.
By modifying CDC_Receive_FS() I am able to receive all data sent form the PC over USB and put the data in my buffer
Also (while the USB cable is connected and PC terminal is opened, I am able to send rarely data to the PC using CDC_Transmit_FS().
The next stage is sending many data via USB (e.g., my trace messages).
For this purpose I need to know when the USB cable is connected or disconnected and when PC is ready to accept my data (at least the PC port is opened) . So I will be able stop and resume my data sending
For USB connection/disconnection I use USER code sections of HAL_PCD_ResumeCallback() and HAL_PCD_SuspendCallback(). Is it OK? (HAL_PCD_DisconnectCallback has no USER CODE section)
My main questions are:
When I write "modifiable" I means that the code will not be lost every time when the Cube Mx recreates the project
Thanks, Alex Gornik
Now I need to detect when the trabsmiittion