cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 Confusion about Dual Bank + setting SCB->VTOR

devtty
Associate III

I'm using an stm32L4R5 with 2 MB dual bank flash. All I am doing is running application from bank 1, copying it over to bank 2, rebooting, running app from bank 2 copying over to bank 1 process continues. This all works fine when I set SCB->VTOR = 0x08000000 within system_stm32l4xx.c. However, if I leave the default generated code:

void SystemInit(void)
{
if defined(USER_VECT_TAB_ADDRESS)
  /* Configure the Vector Table location -------------------------------------*/
SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
  // SCB->VTOR = 0x08000000;
#endif
.....
}

the program can boot from bank 1 and runs the application then after copying to bank 2 and resetting the mcu the application wont run.

SCB->VTOR defaults to 0x00000000 when I do not set it. Why does SCB->VTOR have to be set to 0x080000000 in order for the code to run successfully from both banks? When swapping banks bank2 is taking the place of bank 1 at 0x08000000. I thought everything else should remain the same. Thanks for any clarification.

0 REPLIES 0