STM32 ROM Bootloader – How to Use It

bootloaderi2cmicrocontrollerstm32

I am designing a PCB-Shield that uses the STM32L412CBU6 (without external crystal). This PCB is connected to another STM32 platform. I want to be able to flash the STM32L412CBU6 from within the other platform. I have already a I2C connection from one platform to the other, and I thought about having two more connections between those boards:

  • one to put the BOOT0-PIN high
  • one to toggle NRST-PIN to be able to perform a user-program flash via the internal (ROM) bootloader.

With that in mind, I was reading the documents AN2606 (system memory boot mode) and AN4221 (I2C bootloader protocol definition) and for sure the one for the controller itself "STM32L412xx".

I would like to ask, if I got things right:

  1. When the STM32L412CBU6 boots from system memory (its bootloader), I have to take care, that the hardware resources it uses are not making any electrical problems on my PCB. As this bootloader supports flashing from USART 1, 2 and 3, IC2 1, 2 and 3, SPI 1 and 2 and USB, there are actually something about 22 PINs it handles. Most likely they are not critical – but I have to recheck those PINs.
  2. As per Datasheet AN2606 the I2C3 bootloader uses I2C3_SCL pin and I2C3_SDA pin. In my case (STM32L412CBU6), this would be PIN PA7 and PB4, but the document writes PC0 and PC1 (you can have I2Cx on different PIN-Pairs), which are not present on UFQFPN48 package. If I understand this right, it just means, that the I2C3 bootloader will not be present/accessible on my package. There are no different bootloaders for different packages. Right?

Best Answer

  1. Correct. You can't have anything connected on those pins under normal mode, that would conflict the bootloader use. And vice versa, you can't have anything connected that would get disturbed by the bootloader mode. For example, some pins turn into outputs under bootloader. So there can be nothing driving against those outputs if they are inputs under normal use. The outputs and their state should be tolerated by the rest of the circuit, so you can't have these outputs accidentally turn on or off any circuits that should be in some safe state. And some pins are inputs that must be at some defined state, or at least they must not toggle, so care must be taken that e.g. pushbuttons, pull resistors or other circuits don't accidentally trigger a wrong bootloader interface instead of the one you want.

  2. Yes if the MCU package does not have the mentioned pins then you don't have that interface as the pins are missing. The AN2606 will tell what the pin names are.