Skip to main content
THsu.1
Associate
March 31, 2020
Question

Unable to boot from BANK2

  • March 31, 2020
  • 3 replies
  • 3002 views

Hi, I am new to STM32G4 series. I am implementing dual bank firmware update on STM32G473 custom board. I've prepared two identical bin files(compiled to 0x08000000), and flashed them to 0x08000000 and 0x08040000.

With options bytes:

BFB2=0

nBOOT0=1

nBOOT1=1

nSWBOOT0=1

My board boot from BANK1 and function correctly.

Then I tried to change BFB2 to 1 with STM32CubeProgrammer to boot from BANK2. According to AN2606, it will first boot into system bootloader, and the loader will do valid bank check and boot from it.

However, our board boot into BANK1 code. But I've confirmed by debugger they've entered system loader before running BANK1 code.

I used the following code to check BANK, get_bank() always return 0

/**
 * @brief get current bank
 * @retval int 0 for bank 1, while 1 for bank 2
 */
static inline int get_bank()
{
 return READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_FB_MODE);
}

This topic has been closed for replies.

3 replies

Raouf
ST Employee
March 31, 2020

Hi THsu.1

In order to check whether the MCU has booted from BK2 or not, you can simply check if binary seen @0x08040000 is also mapped @0x00000000, so with CubeProgrammer try to show the content of those addresses. You can also check the FB mode bit and MEMRMP filed.

So please check BFB2 is set and make a power on reset then check if it works.

Regards,

RBEN

THsu.1
THsu.1Author
Associate
April 1, 2020

0693W000000V7BSQA0.png

 I've found that we can actually run mcu in the "CPU" tab in stm32cubeprogrammer

But bootloader doesn't re-map neither BANK1 nor BANK2 to 0x00000000

I read the contents of 0x00000000 with BFB2=1. It seems the mcu will start from bootloader. Which is like AN2606 says, system bootloader will help to check bank2 then do bank swap. . Is it really possible to check if system boot from bank2 with cube programmer? cube programmer will halt the mcu on connection

THsu.1
THsu.1Author
Associate
April 1, 2020

Oh I've found we can actually run mcu, simple go to "CPU Tab" in cube programmer and press run.

But after bootloader jumps to 0x08000000, 0x00000000 still remains bootloader's vector table

THsu.1
THsu.1Author
Associate
April 1, 2020

0693W000000V7BSQA0.png

I read the contents of 0x00000000 with BFB2=1. It seems the mcu will start from bootloader. Which is like AN2606 says, system bootloader will help to check bank2 then do bank swap. . Is it really possible to check if system boot from bank2 with cube programmer? cube programmer will halt the mcu on connection

Associate II
February 23, 2024

I have the same issue, where you able to resolve the problem? How do you tell if your Bank2 program is incorrect