cancel
Showing results for 
Search instead for 
Did you mean: 

Dual-Bank Code Execution and OTA (STM32L073RZ)

mehdihfzp
Associate II

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?

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

2 REPLIES 2
Pierre_Paris
ST Employee

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

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

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.