2025-04-02 4:13 AM - last edited on 2025-04-02 6:18 AM by mƎALLEm
Hi,
I am trying to use the dual-bank mechanism of a STM32L496 MCU.
Using `BFB2` bit of User Configuration register, I am able to switch between bank 1 and bank 2.
My application, using FreeRTOS, runs without problem in bank 1.
However, when I set the `BFB2` bit, it properly boots from bank 2 (I can follow traces sent on the UART proving it), but I systematically get a HardFault, forced from a UNALIGNED fault, that seems to occur during the execution of FreeRTOS's `xPortPendSVHandler`.
Any idea what could be the cause of it ? or how to workaround it?
Thanks in advance for your help.
Solved! Go to Solution.
2025-05-12 7:07 AM
Hi @Saket_Om ,
Thanks for the hint. However, that is the solution I could find on several forums when looking for similar problems, but it did not solve mine.
On the other hand, I think I found a solution: I was using FreeRTOS' `ARM_CM3` port, instead of the `ARM_CM4` (STM32L496 is Cortex-M4-based). With the later, I can run from bank2, so far, without HardFault.
2025-05-12 6:47 AM
Hello @milidam
Please, ensure that the vector table offset register (VTOR) point to the correct address in the bank 2.
2025-05-12 7:07 AM
Hi @Saket_Om ,
Thanks for the hint. However, that is the solution I could find on several forums when looking for similar problems, but it did not solve mine.
On the other hand, I think I found a solution: I was using FreeRTOS' `ARM_CM3` port, instead of the `ARM_CM4` (STM32L496 is Cortex-M4-based). With the later, I can run from bank2, so far, without HardFault.