cancel
Showing results for 
Search instead for 
Did you mean: 

usb cdc doesn’t work on stm32l152

Femah
Associate

I enabled usb cdc by stm32cubemx in an empty project. I connected dp, dm, gnd and (to ground). I tried a 1.5k pull up resistor on dp pin. But still I get “usb not recognized”. I am using stm32l152re-nucleo board.

I have set up usb cdc on other stm boards in the past and didn’t have this issue. I couldn’t find any solution or any information on how this board is different or if I’m doing something incorrectly. 

2 REPLIES 2
KDJEM.1
ST Employee

Hello @Femah and welcome to the Community 🙂,

I advise you to follow this FAQ: USB device not recognized, with the solution is to either increase the heap size, or configure the USB library to use static allocation.

The USB library configuration requires enough space to allocate the structure related to the implemented USB class (e.g. USBD_CDC_HandleTypeDef in case of CDC class implementation). A value of 0x1000 heap size should be enough for most cases.

I hope this help you to solve the issue.

Kaouthar

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.

thanks for your reply.

I tried this but didn't help.