2018-03-15 04:10 AM
I have two customer boards as below :
A board : Mount with STM32L4R5QII (2MB internal flash)B board : Mount with STM32L4R5QGI (1MB internal flash)A board run well on the STM32L4R5ZI-Nucleo\examples\flash many times.
B board will stop a error (program error) as attached file.If i do a chip erase before run the example on B board it will work on first time.So i guess the program can't erase the sector correctly .Any comment , Thanks
#flash-example-can't-not-run-on-stm32l4r5qg2018-03-15 05:33 AM
I found the problem is because the bank size different .
The bank size of STM32L4R5QII is the 0x00100000 but the bank size of the
STM32L4R5QGI is the 0x0080000.
It cause the Flase_Erase did not erase the enough sectors for program .
I assume the example will work on all STM32L4R5xx series but it did not .
What is the correct bank size of the
STM32L4R5QGI ??
Thanks .
2018-03-15 06:56 AM
I'd presume you'd need to pass the specific part as a define
But more generally you'd look to read the Flash Size parameter programmed in the system space, and look at the option settings or flash configurations settings and make a run time determination about what mode/state the banking is running in.
2018-03-15 08:38 PM
The FLASH_BANK_SIZE return from file stm32l4xx_hal_flash.h is
0x0080000 (512KB) on the
STM32L4R5QGI .
If i want to erase 1 sector at address 0x08080000 so i call the HAL_FLASHEx_Erase() with below parameters :
Banks=2 , Page = 0 , NbPages = 1
But it did not erase this sector.
I need to pass the below parameters :
Banks= 1 , Page = 128 ,
NbPages = 1
I need to set the Banks to 1 even the address over the 512KB .
Any comment !