Quick hack: Add native (user) USB to ST’s Nucleo boards

I recently bought myself one of ST’s cheap Nucleo development boards with an STM32F072RB controller on it to quickly start developing one of my projects. The microcontroller has native USB support even without an external clock which makes it quite attractive.

The downside is that this board does not come with a USB connector that can be used by the controller itself. The USB connector on it is already used by ST’s own programmer (ST-Link). You could of course rewire the port to the microcontroller directly – but then you would lose the connection to the ST-Link and had to connect an external programmer.

So I came up with another solution: I just glued a straight (180°) THT mini USB connector to the bottom side of the board and wired the USB-D- pin to PA11 and USB-D+ pin to PA12. Luckily both pins are not already used on the board and are easily accessible since they are routed to pin headers. USB GND (and shield) must also be connected to GND. You can see the little hack in the following picture. The same hack can probably be done with all Nucleo boards that provide a controller with USB support. Maybe someone finds this useful. 😉

Glued mini USB connector to bottom side of Nucleo board and wired the data lines to the microcontroller port pins. Fits well. ;-)
Glued mini USB connector to bottom side of Nucleo board and wired the data lines to the microcontroller port pins. Fits well. 😉

Happy hacking,


12 Replies to “Quick hack: Add native (user) USB to ST’s Nucleo boards”

    1. Hi Zhenya,

      the connection to +5V of USB is not needed in my case because I supply the board separately using the other USB connector (ST-Link).
      Technically you are not required to connect pin 1 of the USB connector (that is if you don’t need the 5V).

      Kind regards,

        1. This will not work. The STM32F072 device has a USB device interface, not a USB host interface.
          Your modem is already a device so there is no way to connect two USB devices together.
          It needs a host interface (e.g. a PC, Raspberry Pi, etc.).

    1. Yes, that could work. But keep in mind that you must write a USB device driver for your modem. This is probably not an easy task.

        1. Sorry, I cannot help you with this. I have never done anything with the USB host interface or with a GSM modem as USB device. This is also out of scope of this article.

  1. Hi André,

    Hope you can help me out! Did you use an IDE? If so, which IDE did you use? Did you by any chance use mbed? If so, which library, because all the libraries I found, were without the F072RB target. Any chance of sharing your code?

    Thanks in advance!

    1. Hi,

      the IDE I am using is just plain Eclipse in combination with the GNU ARM toolchain. I don’t use any libraries expect for ST’s standard peripheral library. You can find a good starting point in ST’s standard peripheral library which also includes some USB examples like the Virtual Comport implementation.

      Kind regards,

Leave a Reply

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