Skip to main content
Visitor II
February 25, 2024
Solved

Dual-Bank Code Execution and OTA (STM32L073RZ)

  • February 25, 2024
  • 1 reply
  • 2369 views

Hi dear experts,

I want to know is there a way to only program Bank2 and run the firmware from it? I manage to program Bank2 and set the BFB2=1 but i cant get the firmware to run. Am i making a mistake by not programming the Bank1 at all? 
i should mention that i used a right linker file for Bank2 firmware and i have also take a look the AN4767 and AN2606.  Do I need any additional code to be programmed to Bank1 even if I'm not using it at all?

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

    I actually found the problem. In my case i didn't pay attention to SYSCFG_CFGR1_UFB register. I was trying to switch the bank purely with the BFB2 option byte and also built the firmware for the address of bank2 which is wrong. Actually didn't know that when i switch the bank, the second bank's address will be always be bound to virtual address 0x08000000. Thanks to all the experts who have participated in this topic.

    1 reply

    ST Employee
    February 26, 2024

    Hello @mehdihfzp,

    Thank you for your question !

    Here are some questions / remarks  :

    • How the boot pins are configured ? (BOOT0 and BOOT1) 
    • Is the UFB bit in SYSCFG_CFGR1 set ? What is the value of SYSCFG_CFGR1 ?
    • I suggest you to download the X-CUBE-DBFU expansion package here.

    Q1 : Am i making a mistake by not programming the Bank1 at all?

    A1 : No, as mentionned in the RM0367, the STM32L0x3 have a dual boot capability depending on BFB2 bit status. It is important to keep BFB2 flag set when there is no code in Bank1, thus being safe in case of unexpected power failures.

    Q2 :  Do I need any additional code to be programmed to Bank1 even if I'm not using it at all?

    A2 : No, if you are not using it at all but what is your application ? 

    Best Regards,

    Pierre

    mehdihfzpAuthorAnswer
    Visitor II
    February 27, 2024

    I actually found the problem. In my case i didn't pay attention to SYSCFG_CFGR1_UFB register. I was trying to switch the bank purely with the BFB2 option byte and also built the firmware for the address of bank2 which is wrong. Actually didn't know that when i switch the bank, the second bank's address will be always be bound to virtual address 0x08000000. Thanks to all the experts who have participated in this topic.