cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0B1 USB fails to request device descriptor

romp
Associate

Hi, I'm running into problems registering USB interfaces on STM32G0B1KBU6.  The same code works fine on STM32F1*, STM32F7*, and STM32G4*.

Environment: latest STM32CubeIDE (v.1.13.2) @ Windows.  Target: custom board with STM32G0B1KBU6, which uses the following peripherals: USB, CANbus, 9x PWM out lines and a digital GPIO in (the details are below).  Flashing is done over SWD using either ST-Link v.2, or J-Link Base, directly from the CubeIDE.

For debugging, I've reduced the problem to a new and empty CubeIDE project for this chip, adding only the USB and one timer.  No custom code: just what's generated by the IDE.  No matter what USB device class is selected in *.ioc->Middleware and Software Packs -> USB_DEVICE -> Class For FS IP, the device fails to be recognized by the host (both Windows and Mac).  The message provided by a Windows host is "Device Descriptor Request Failed".  If I step over the init functions, the host reports this message exactly when the following stack flips the USBx->BCDR.USB_BCDR_DPPU bit:

HAL_PCD_Start() at stm32g0xx_hal_pcd.c:981 0x8001302
USBD_LL_Start() at usbd_conf.c:474 0x8005d86
USBD_Start() at usbd_core.c:378 0x80056cc
MX_USB_Device_Init() at usb_device.c:82 0x80058dc
main() at main.c:96 0x8000238

The USB stack never requests any of the device descriptor fields (doesn't hit the breakpoints there), although the valid descriptor is passed correctly by MX_USB_Device_Init() into USBD_Start().

On the hardware side:

  • the device is powered by the USB's 5V rail via a 3v3 LDO
  • power at the chip is verified stable 3v3, decoupled with a 1uF and a 0.1uF right by the power pin
  • the USB is connected via USB-C plug, with CC1 and CC2 grounded via 5k1 resistors (one per pin)
  • there's USBLC6-2P6 between the plug and the PA9/PA10 of the chip.  Removing/replacing it doesn't change the outcome
  • replaced the STM32 chip to ensure that it wasn't a hardware issue -- no change
  • verified that the firmware is written correctly by dumping it in jlink.exe
  • for debugging, all peripherals are removed and/or disconnected
  • captured the full a USB traffic log in logic analyzer.

Please let me know if I should provide the USB capture or any other info.

Hope this has a known solution.  Thank you so much for looking into this!

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

I would try to get a USB example from the CubeMX repository running. Those tend to be more robust than the automatic CubeMX code generation. Here is one such example, may need to be tweaked slightly for your specific hardware.

https://github.com/STMicroelectronics/STM32CubeG0/blob/11bf550bba048e55fb465842fa0b2d1f13660868/Projects/STM32G0C1E-EV/Applications/USB_Device/CDC_Standalone/readme.txt#L114

Once that is working, diff the two codes to determine differences.

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

View solution in original post

1 REPLY 1
TDK
Guru

I would try to get a USB example from the CubeMX repository running. Those tend to be more robust than the automatic CubeMX code generation. Here is one such example, may need to be tweaked slightly for your specific hardware.

https://github.com/STMicroelectronics/STM32CubeG0/blob/11bf550bba048e55fb465842fa0b2d1f13660868/Projects/STM32G0C1E-EV/Applications/USB_Device/CDC_Standalone/readme.txt#L114

Once that is working, diff the two codes to determine differences.

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