Skip to main content
Visitor II
April 25, 2025
Question

question about STM32G474 dual banks

  • April 25, 2025
  • 3 replies
  • 700 views

I have a test question about STM32G474 dual banks to ask :
A test program for LED flashing has been successfully constructed in the IAR environment.
Use STM32CubeProgrammer to load BANK1 starting from 0X8000000, DBANK=1,BFB2=0, and the program runs OK
When BANK2 starting from 0x8040000 is loaded, DBANK=1 and BFB2=1, the program cannot run
May I ask to see if there are any problems with my application Settings

thank you

    This topic has been closed for replies.

    3 replies

    Technical Moderator
    April 25, 2025

    Hello,

    Look at the example provided in the STM32G4 Cube package especially the example FLASH_DualBoot located at this Github link.

     

    Visitor II
    April 25, 2025

    Thank you
    Yes, I have referred to this program
    Now I'm just verifying the deployment of the firmware in a manual way. Later, the program switching process will be placed in the program (my application is digital power firmware deployment and upgrade).
    The firmware is fine when deployed on BANK1, but not on BANK2.
    This is exactly what I want to consult.
    You can also have a try.
    Thank you for your reply

    Visitor II
    April 25, 2025

    the process below:

    微信图片_20250425193045.png微信图片_20250425193143.png微信图片_20250425193211.png微信图片_20250425193232.png微信图片_20250425193255.png微信图片_20250425193314.png微信图片_20250425193350.png

     

    Visitor II
    May 3, 2025

    Both banks will be swapped with BFB2=1 and all addresses from BANK2 will be remapped to BANK1 (and vice versa).

    Otherwise the flash addresses, generated by compiler, would all be wrong. So the start address for booting from BANK1 (BFB2=0) and from BANK2 (BFB2=1) also stays the same virtually @0x08000000.

    If you want to ask if you booting from BANK1 or BANK2 you can read the memory remap status in MEMRMP register:

    DWORD GetBootBank(void)
    {
     return (READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_FB_MODE) == 0) ? FLASH_BANK_1 : FLASH_BANK_2;
    }