2019-08-06 01:12 AM
Hi, I plan to use the STM32L082 for a product that must be safely in-field upgraded. I am trying to understand the dual bank feature to see if this could help me.
I would like to have the production firmware in Bank 1 via SWD, and the Bank 2 would be reserved to receive new firmware via RF. The bank 1 must be kept as a backup and never overwritten. Only the production firmware can receive and upgrade the MCU by writting bank 2. Could you challenge this strategy ?
I have read the documentation about the dual bank, the bank swap and so on, but I cannot find a clear explanation about the bank swap. I am confused about the remapping, the aliasing and the bank swapping. As an example, my production firmware "A" in bank 1 receives a new firmware "B", writes it in bank 2 and resets the MCU to start in bank 2 thanks to the BFB2 bit set. If I understand well, the system memory will check if the code is valid on bank 2 and jump on it. But, are the firmwares still in the same banks ("A" in bank 1, "B" in bank 2), or are they now swapped ("B" in bank 1 and "A" in bank 2) ? Since it is not clear in my mind, I do not know if I will be able to always boot onthe newest firmware which is always in bank 2 or not.
Thanks a lot for your help !
2019-08-06 05:18 AM
Have your primary firmware, or loader section, make the decision about which image to run and the validity of the images, NOT the system ROM.
Have the same loader code in both so the swap can fork easier.
Experiment so you understand the mechanics completely.
2019-08-06 05:42 AM
Hi,
So you recommend to always start on bank 1 with the production firmware and to jump to bank 2 if valid ?
Why you do not want to use the system ROM ? It looks like it does exactly what I would like to do, so if I can avoid to rewrite it.
A very important question that I cannot answer yet, do the banks remain swapped after a reset ?
2020-04-16 02:43 AM
I answer to myself to help people that could have the same question. The banks remains swapped even after a power cycle since the BFB2 bit is in the non volatile memory, but it is always possible to know which bank is used.