3
\$\begingroup\$

I just wanted to ask, how do you program ARM based microcontrollers (mainly) through a USB-port?

Until now, I was constantly working with the Arduino IDE and "arduino-ish" microcontroller, which had to be programmed via another Arduino through ISP and then could be connected directly to the PC and programmed through the ArduinoIDE

Now for the ARM based microcontroller board I wanted to use something like the STM32 IDE because of the GUI with an STM32 microcontroller which supports USB FS and DFU.

But don't I need to first upload a bootloader to the microcontroller in order to be recognised by any IDE / Windows itself or can I just plug it into the computer and it's going to be recognised as a communication device and can be programmed directly? Otherwise I would need to have some pins available uploading the bootloader via a FTDI chip.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ It's really a family issue… there are some part with an embedded bootloader in factory that enumerates on the bus as a firmware update endpoint when they start with some magic boot pin set (i.e. a jumper or a switch to be pressed while plugging in). No idea about the STM32 however, check the application notes for the family \$\endgroup\$ Oct 19, 2021 at 7:28

2 Answers 2

3
\$\begingroup\$

STM32CubeMX provides an excellent debugger. If you're used to Arduino IDE that doesn't have a debugger, you might not realize how useful this is for development. A fast serial port is also a must for all those printf()'s. If you decide to use a bootloader for development and use the SWD pins as GPIO, or you don't put the debug connector, then you won't be able to use the debugger when you need it.

To enable this, you can use a STM32 programmer like STLINK which is very cheap. Nucleo boards include one, if you desolder a couple resistors and move jumpers to enable the SWD/UART headers.

Bootloader is better suited to uploading a new firmware when development is almost finished and you don't need to debug, or for upgrading in the field when the device is not connected to the PC with the debugger.

\$\endgroup\$
2
\$\begingroup\$

The STM32 MCUs come with factory bootloader, and if it supports DFU then you can directly program it via USB.

For the parts that do not support USB or don't support DFU in the factory bootloader, you can use any of the available interfaces like UART, SPI, I2C or CAN.

Failing that or if you just want to use JTAG or SWD then those interfaces can be used for programming firmware but also for debugging.

\$\endgroup\$
2
  • \$\begingroup\$ It does support USB DFU. But in which case do I need the "STM Cube Programmer"? The microcontroller should be recognised as a programmable device by any IDE or am I wrong? Basically, I would need to still upload a firmware like in EEVblog's video: youtube.com/watch?v=2CDN8EQmOeo&t=581s to be recognised by Windows/IDEs, right? \$\endgroup\$
    – Dakalaom
    Oct 19, 2021 at 7:41
  • \$\begingroup\$ DFU is a standard protocol used by many. The CubeProg is a programming software that can program via many interfaces, including DFU. The CubeIDE is for software developement and generally used for debugging so there is no need to support any other means of programming except via JTAG and SWD. If the manufacturer bootloader supports DFU then you do not need to upload any custom bootloader for DFU support. \$\endgroup\$
    – Justme
    Oct 19, 2021 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.