Difference between revisions of "STM32 How to flash"

From Stm32World Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:STM32 Development]]
+
[[Category:STM32]][[Category:STM32 Documentation]]{{metadesc|How to flash STM32 MCUs}}
 
When first getting involved with [[STM32]], one of the first road blocks is often the sheer number of different choices.  There are literally hundreds of different STM32 micro controllers and at first it appears extremely overwhelming.  That is, up until you realize that there are only a few (4-5) families and the rest of the choices are up to speed and IO.  When it comes to flashing, the number of options are just as overwhelming and confusing.  This page is an attempt to clear up that confusion.
 
When first getting involved with [[STM32]], one of the first road blocks is often the sheer number of different choices.  There are literally hundreds of different STM32 micro controllers and at first it appears extremely overwhelming.  That is, up until you realize that there are only a few (4-5) families and the rest of the choices are up to speed and IO.  When it comes to flashing, the number of options are just as overwhelming and confusing.  This page is an attempt to clear up that confusion.
  
Line 40: Line 40:
 
|}
 
|}
  
== Serial Wire Debug (SWD) ==
+
== Device Flash Methods ==
 +
 
 +
=== Serial Wire Debug (SWD) ===
  
 
To be added
 
To be added
  
== JTAG ==
+
=== JTAG ===
  
 
To be added
 
To be added
  
== UART ==
+
=== UART ===
  
To be added
+
[https://www.st.com/resource/en/application_note/cd00264342-usart-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf AN3155 USART protocol used in the STM32 bootloader]
 +
 
 +
=== I2C ===
 +
 
 +
[https://www.st.com/resource/en/application_note/dm00072315-i2c-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf AN4221 I2C protocol used in the STM32 bootloader]
 +
 
 +
=== SPI ===
 +
 
 +
[https://www.st.com/resource/en/application_note/dm00081379-spi-protocol-used-in-the-stm32-bootloader-stmicroelectronics.pdf AN4286 SPI protocol used in the STM32 bootloader]
  
== I2C ==
+
=== CAN ===
  
To be added
+
[https://www.st.com/content/ccc/resource/technical/document/application_note/56/94/0c/7d/63/f6/4d/96/CD00264321.pdf/files/CD00264321.pdf/jcr:content/translations/en.CD00264321.pdf AN3154 CAN protocol used in the STM32 bootloader]
  
== SPI ==
+
=== Device Firmware Update (DFU) ===
  
 
To be added
 
To be added
  
== CAN ==
+
== Flash Tools ==
  
To be added
+
=== DFU Web Flash ===
  
== Device Firmware Update (DFU) ==
+
Some [[STM32]] [[MCU]]s support [[DFU]] (Device Firmware Update) through [[USB]].  These devices can actually be flashed through a web browser without using any tools at all.
  
To be added
+
[https://devanlai.github.io/webdfu/dfu-util/ https://devanlai.github.io/webdfu/dfu-util/]

Latest revision as of 02:06, 13 April 2022

When first getting involved with STM32, one of the first road blocks is often the sheer number of different choices. There are literally hundreds of different STM32 micro controllers and at first it appears extremely overwhelming. That is, up until you realize that there are only a few (4-5) families and the rest of the choices are up to speed and IO. When it comes to flashing, the number of options are just as overwhelming and confusing. This page is an attempt to clear up that confusion.

The first thing to realize is that every single STM32 micro controller has to a built-in boot ROM which is programmed at the factory. This ROM can never be changed. When a STM32 is powered up, it will pull the Boot0 pin low with a weak internal resistor and then check the level of the pin. If the pin is low, the user code stored in flash will be executed, but if the pin is high, the internal factory bootloader will be executed.

Bootloader

The exact features of the bootloader depends on the STM32 family. Some features are available on every single STM32 device, while others are only available on a subset of STM32s.

The following (incomplete) table attempts to summarize the bootloader features in the different STM32 devices:

Devices SWD JTAG UART I2C SPI CAN DFU
STM32F1 X X X
STM32F4 X X X X X X X

Device Flash Methods

Serial Wire Debug (SWD)

To be added

JTAG

To be added

UART

AN3155 USART protocol used in the STM32 bootloader

I2C

AN4221 I2C protocol used in the STM32 bootloader

SPI

AN4286 SPI protocol used in the STM32 bootloader

CAN

AN3154 CAN protocol used in the STM32 bootloader

Device Firmware Update (DFU)

To be added

Flash Tools

DFU Web Flash

Some STM32 MCUs support DFU (Device Firmware Update) through USB. These devices can actually be flashed through a web browser without using any tools at all.

https://devanlai.github.io/webdfu/dfu-util/