Getting a Nucleo to work

Nucleos are very nice little dev boards for STM32 microcontrollers. I’ve been using a Nucleo-f446 for some embedded projects over the last two years, but always reluctantly because it would only work with my worst laptop which I keep around specifically for this purpose. They have integrated ST-Link programmers/debuggers which I’ve had issues using due to USB bugs. After a long time I’ve finally gotten it working.

When plugged in over USB, the Nucleo should register as both a 88k block device and as a serial console (/dev/ttyACM[0-9]). The Nucleo is programmed just by moving files onto the block device, and can be interacted with over the serial terminal. On some machines it would just show up as a block device, and on others it would not show up at all. When plugged in, the following would be outputted to dmesg:

[  555.818115] usb 5-2: new full-speed USB device number 5 using xhci_hcd
[  555.989838] usb 5-2: New USB device found, idVendor=0483, idProduct=374b
[  555.989840] usb 5-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  555.989842] usb 5-2: Product: STM32 STLink
[  555.989844] usb 5-2: Manufacturer: STMicroelectronics
[  555.989845] usb 5-2: SerialNumber: 0669FF515056805087142030
[  555.990035] xhci_hcd 0000:0a:00.3: ERROR: unexpected command completion code 0x11.
[  555.990320] usb 5-2: can't set config #1, error -22

I initially thought the kernel was responsible with cdc-acm. I’m not going to describe all the things I’ve tried and instead skip right to the solution. The Nucleo only properly registers when I plug it into my only USB3.1 port instead of any of the USB3.0 ports.

Edit: It also appears not always enumerate unless there are no periphereals plugged into it.

Edit2: I’ve moved to using SW4STM32, and the automatic stlink firmwire update allowed me to use it with any usb plug on my desktop.

Author: Garth Whelan


Leave a Reply

Your email address will not be published. Required fields are marked *