Skip to main content
Explorer
August 16, 2024
Solved

STM32 ROM bootloader, initial state and when erased

  • August 16, 2024
  • 1 reply
  • 3111 views

Hi,

On the STM32 F4 products, there is a hardware/ROM bootloader, that can be activated through the BOOT0 pin. It works great, no issues with that.

In a production environment, I would like to flash the board automatically, without manually pressing buttons on a board.

My question is related to the "initial condition" of an STM32 F4 MCU. I was hoping the bootloader would be activated on boot, if there is no application to run. E.g if the flash memory is erased and all FF's.

I tried doing a full chip erase and reset, but it does not enable the USB DFU options.
Is the default behavior, from the factory, that the ROM bootloader is active? Without activating the BOOT0 pin.

Any recommendations on how to flash an STM32 MCU in a fairly low volume production environment? Preferably, using the USB connection and not the SWD connectivity.

    This topic has been closed for replies.
    Best answer by TDK

    > I still cant figure out if a factory STM32 F4 enables the system bootloader, with USB DFU, on initial boot.

    It will not. You need to pull BOOT0 high.

     

    The initial value of BFB2 and other option bytes are listed in the reference manual. The as-delivered state is BFB2=0.

    AN2606 has a lot of information. Look only at what is relevant to your chip. There are a lot of STM32F4 models, you'll need to be more specific. Figure 14 is not relevant and only one section of Table 2 is relevant depending on your part number.

     

    1 reply

    Visitor II
    August 16, 2024

    see Figure 1

    sbendAuthor
    Explorer
    August 16, 2024

    Thank you for the information! I might be reading it wrong, but it only describes the DFU bootloader, after it has been activated. My questions is more related to, the conditions that activates the bootloader. 

    In the document you provided, there is a reference to an2606, that describes the activation patterns:

    https://www.st.com/resource/en/application_note/an2606-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf 

    Table 2 has a lot of defined patterns for the bootloader and I see one of the conditions is "empty" flash. I assume this is the case for factory provided MCU's.

    Figure 14 has more details about bootloader activation for the F4's

    Activation is then dependent on BFB2(bit) and nBoot0_SW(bit) values. Do you/any know the initial factory state of those two bits?
    I still cant figure out if a factory STM32 F4 enables the system bootloader, with USB DFU, on initial boot.

    TDKAnswer
    Super User
    August 16, 2024

    > I still cant figure out if a factory STM32 F4 enables the system bootloader, with USB DFU, on initial boot.

    It will not. You need to pull BOOT0 high.

     

    The initial value of BFB2 and other option bytes are listed in the reference manual. The as-delivered state is BFB2=0.

    AN2606 has a lot of information. Look only at what is relevant to your chip. There are a lot of STM32F4 models, you'll need to be more specific. Figure 14 is not relevant and only one section of Table 2 is relevant depending on your part number.