cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L082 - Dual NVM banks (how to boot from bank2)

Jeroen deBuffel
Associate III

Dear ST experts,

I am using the STM32L082 and looking to utilize the Dual Banks to be able to upgrade the firmware (swap between bank1 and bank2 and visa versa).

Have compiled code for BANK1 and compiled for BANK2. Code flashed to BANK1 (0x0800 0000) and BANK2 (0x0801 8000). With BFB2 bit set and reset I cannot see any activity (when running from BANK1 I see serial output).

Am I missing anything?

Thanks in advance

6 REPLIES 6
Bubbles
ST Employee

hi @Jeroen deBuffel​ ,

the dual bank swapping works with remapping the memory. So in fact you should have code built for bank1 in BOTH banks. when the banks swap, bank2 is remapped to bank1 address range and the code will execute. See here for actual application:

https://www.st.com/resource/en/application_note/dm00230416-onthefly-firmware-update-for-dual-bank-stm32-microcontrollers-stmicroelectronics.pdf

BR,

J

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.

Jeroen deBuffel
Associate III

Hi J,

Thanks a lot for your feedback. I did read the AN your referred to earlier but I misunderstood.

Now when I understand correctly this time -> the following should work for the stm32L082:

  • Exact same code for bank1 can be written in bank2.
  • Flash bank1 and bank2 at the addresses as mentioned earlier.
  • Set BFB2 flag (1)
  • Reset the processor
  • Bank2 code will be running

KRs,

deBuffel

Hi @Jeroen deBuffel​ ,

you are welcome. I'm the author of that AN, so if you have some suggestion how to make it clearer, I'd be very pleased. If you misunderstood while reading it, surely there is a room for improvement in the AN text.

BR,

J

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.

Hi @JHOUD​ ,

Would be more than happy to provide you my feedback wrt the AN. I suggest I do it once I have the dual bank solution working (will send you the comments in a DM).

Btw - the steps I described above are correct?

KRs,

deBuffel

Hi @Jeroen deBuffel​ ,

sorry I was out of office last few days. Yes, that steps are correct. Though as I try to demonstrate in the example, it's not the only option. It's also possible to live switch the banks during execution (with some constraints).

BR,

J

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.

Jeroen deBuffel
Associate III

Thanks - will try to get it working in the coming weeks