cancel
Showing results for 
Search instead for 
Did you mean: 

"usb device not recognized" STM32G0B1ME

seba21
Associate II

 

Hello everyone,
I’m trying to activate the USB module present on my custom board equipped with the STM32G0B1ME microcontroller. Currently, I would like to see data transfer from a PC serial terminal to the microcontroller. Unfortunately, this is not happening at the moment, as upon powering on the device I receive "USB device not recognized."

The hardware is as follows (USB Type-C):

seba21_0-1729691001440.png

seba21_1-1729691005800.png

Unfortunately, I did not design it, and I currently cannot modify it.

The firmware configuration is as follows:

seba21_2-1729691027572.png

seba21_3-1729691036793.png

seba21_4-1729691042048.png

 

with USB, UCPD1 and UCPD2 global interrupts enabled.

In the main, I simply have:

 

 

 

#include "usbd_cdc_if.h"
...
MX_USB_Device_Init();
...
uint8_t *data = "Hello World from USB CDC\n";
...
while (1) {
...
CDC_Transmit_FS(data, strlen(data));
HAL_Delay(1000);
}

 

 

But... "USB device not recognized".

I have verified that the drivers are correct because if I follow the same procedure with the STM32G0B1RE Nucleo board, it works...

Thanks for help!

5 REPLIES 5
gbm
Lead III

Check the clock - hardware and software config. Is the clock hardware the same as in Nucleo? What clock is used for USB?

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
seba21
Associate II

You're right. I didn't notice that, while the Nucleo board uses HSE48, the custom board uses HSI48 RC. I hadn't considered this before. I don't think HSI is precise enough to handle USB...am i wrong?

HSI48 is the right oscillator, provided you turn on synchronization to USB SOF in CRS.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
seba21
Associate II

Yes, the CRS SYNC is configured as CRS SYNC Source USB. I forgot to insert the screenshot of this in the first question...but the problem remain.

It's definitely not a good idea to attempt to send the data before the full connection is established. There was discussion on it in few threads. See the thread: https://community.st.com/t5/stm32-mcus/how-to-use-stmicroelectronics-classic-usb-device-middleware-with/ta-p/599274

Also, calling transmit from the main loop will at some point hang the USB stack.

You may try running my USB demo made for Nucleo-G0B1 on your board - it doesn't use the HSE. If it fails, then look for hardware problem. Note that HIS48 is for USB only, you need to use HSI with PLL for main clock, like in my demo.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice