I'm having problems enabling USB on STM32H503 and I'm hoping there's a simple solution that you can point me to.
The problem happens on both my custom board (STM32H503CBT6-based), as well as on MB1814B (STM32H503RBT6-based). Here's the simplest repro:
- in STM32CubeIDE, latest available version (1.17.0), create new STM32 project for STM32H503RBT6 core
- in .ioc, enable I-Cache, SWD, and USB. In "Middleware and Software Packs", the USBX section, enable "Core System", "Device CoreStack FS", "CDC ACM"
- close .ioc, build the project
- connect MB1814B to the host on both sides
- flash the compiled firmware
Result:
- the host only sees the piped-through-SWD-end Virtual COM, but fails to see the USB connection on the device side
- the onboard firmware fails to invoke the USB interrupt
- the core fails to initiate hardware handshake
Similar steps on my custom H503CBT-based device result in similar outcomes: no USB connection, no IRQ ever being invoked, no hardware handshake
To give you an idea of my experience level, previously I designed, built, brought up and shipped several STM32-based devices that use USB CDC stack. The devices were based on F4, G0, and G4 cores. This is the first time I'm using H5 core.
Troubleshooting steps I've done on my board:
- in debugger, verified that all the obvious IDE-generated init functions are called (they are), the clock and IRQ are enabled (they are), the IRQ vector points to my `USB_DRD_FS_IRQHandler()` handler and not the weak handler (ditto), and that the registers contain the expected values at the start of the forever loop (they do, as far as I can tell)
- verified power on all VDD pins (3v3 nominal, 3v282 - 3v297 measured), verified my board for shorts, etc. Removed the LDO and powered the board from the bench, verified power consumed
- swapped the microcontroller on my board just in case
- removed the USB ESD protection from my board, just in case
- removed all other devices from my board, just in case
- hooked up USB_DM and USB_DP lines (PA11 and PA12) to oscilloscope -- no signals on these lines
- tried to clock USB from both the HSI48 and HSE (25 MHz-based)
- changed the core's clock between 25 MHz and 250 MHz
- swapped the USBX to the old USB stack that I last used few months ago on STM32G0 -- same result
- swapped the USBX to the same old USB stack taken from https://github.com/STMicroelectronics/stm32-mw-usb-device/tree/2022e75b01a499b17acd17d28691b1ed5bbef2dc -- same result
Troubleshooting I've done on MB1814B:
- verified that the jumpers are set correctly for the USB Device configuration: SB1, SB7, SB14 -- off, SB4 and SB8 -- short
- verified power before and after plugging the device-side USB-C
- found that the board has silkscreen for R34 and R35 mixed up
- verified that other devices on the board work fine: PWM, UART, I2C
Thank you very much for looking into it!