cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 HAL CDC example

Posted on November 25, 2015 at 13:25

Hello there,

I am trying to use usb device cdc protocol for my device. I have sucessfully generated code with CubeMX and the COM port is visible on my connected PC. The problem is, I cannot find any examples on how to send/ receive data using that virtual com port. I have searched in the examples but I think the only show usb-> serial adapter, the data is automatically forwarded to uart port. I was wondering how Can I receive data in interrupts, DMA and etc. I cannot find send/ receive functions in the code... I would really apreciate all help.
2 REPLIES 2
Amel NASRI
ST Employee
Posted on November 25, 2015 at 13:50

Hi Bremen,

You didn't tell us which part are you using.

For F4 devices, you find a CDC example under STM32Cube_FW_F4_V1.9.0\Projects\STM324xG_EVAL\Applications\USB_Device\CDC_Standalone.

Then you have the user manual (UM1734 for USB device and 1720 for USB Host) that may help you to use HAL functions in order to develop your application.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Posted on November 25, 2015 at 13:58

I am suing STM32F407. I have seen the examples, but I cannot understand how to create a reception interrupt routine and how to send data over usb cdc device.

Edit: I found them. They are in usbd_cdc_if.c file if anyone needs them.