cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4A6 and dual Bank (BFB2)

PCu1
Senior

Hello,

I'm having an issue with the STM32L4A6(1Mb) and the dual-bank.

First of all, I tried with the NUCLEO-L476 and a simple blink led. It worked fine.

Now, my project is based on a STM32L4A6, but the firmware doesn't start in BANK2.

For simplicity, I did the same program blink led as for the STM32L476

This is what I implemented in SystemInit():

VECT_TAB_OFFSET is 0x80000

void SystemInit(void)
{
#if defined(USER_VECT_TAB_ADDRESS)
  /* Configure the Vector Table location -------------------------------------*/
	FLASH_OBProgramInitTypeDef FLASH_OBProgramInit = {0};

	//Read all options bits
	HAL_FLASHEx_OBGetConfig(&FLASH_OBProgramInit);

	//Check the BFB2 bit
	if (FLASH_OBProgramInit.USERConfig & FLASH_OPTR_BFB2)
		SCB->VTOR = VECT_TAB_BASE_ADDRESS | VECT_TAB_OFFSET;
	else
		SCB->VTOR = VECT_TAB_BASE_ADDRESS;
#endif

  /* FPU settings ------------------------------------------------------------*/
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)
  SCB->CPACR |= ((3UL << 20U)|(3UL << 22U));  /* set CP10 and CP11 Full Access */
#endif
}

 

I flashed the same code at 0x8000000 and at 0x8080000(half memory).

I did the workaround as mentionned in the errata sheet:

PCu1_0-1754304811567.png

But nothing to do, the program never starts in BANK2.

May be an idea?

Pierre

0 REPLIES 0