2024-10-23 06:46 AM - last edited on 2024-10-25 02:12 AM by Andrew Neil
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):
Unfortunately, I did not design it, and I currently cannot modify it.
The firmware configuration is as follows:
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!
2024-10-23 07:49 AM
Check the clock - hardware and software config. Is the clock hardware the same as in Nucleo? What clock is used for USB?
2024-10-23 07:56 AM
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?
2024-10-23 09:34 AM
HSI48 is the right oscillator, provided you turn on synchronization to USB SOF in CRS.
2024-10-23 11:34 PM
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.
2024-10-24 05:12 AM
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.
2024-11-11 06:04 AM
Hi @seba21
Maybe, because on package STM32G0B1ME, you need to check VDDIO2 pin. It must not be applied without valid VDD.
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.