cancel
Showing results for 
Search instead for 
Did you mean: 

USB received data interrupt callback

jlthompson
Associate III

I'm using the STM32F401RE in a new design and trying connect the USB CDC device interface to FreeRTOS_CLI. I modified its _write function to call CDC_Transmit_FS, but I don't see a received data callback where I can add a xTaskNotifyFromISRfor to send data to the CLI task.

It looks like I call CDC_Receive_FS to get the data, but I need an interrupt to trigger the call to that function. Where can I hook in a callback function?

1 REPLY 1
TDK
Super User

CDC_Receive_FS is called from an interrupt context when new data comes in. You don't call it directly.

Be aware that CDC_Transmit_FS will fail if the USB is still busy from the previous call to it. Also, the data needs to remain valid until the operation is complete. It's generally not compatible with how _write is called due to these reasons.

If you feel a post has answered your question, please click "Accept as Solution".