STM32L496ZG flash program issue
Hi,
I am working on STM32 flash program using a sample program from V1.11. The program is pretty straight forward. Erase ADDR_FLASH_PAGE_16 to ADDR_FLASH_PAGE_255 then program.
The program stuck in HardFault_Handler doing HAL_FLASHEx_Erase in the first page erase FLASH_PageErase(page_index, pEraseInit->Banks);
HAL_FLASH_Program()
also failed on FLASH_Program_DoubleWord().Anyone experienced same issue? Doesn't this supposed to be working without any changes?
Thx
STM32Cube_FW_L4_V1.11.0\Projects\NUCLEO-L496ZG\Examples\FLASH\FLASH_EraseProgram
if (HAL_FLASHEx_Erase(&EraseInitStruct, &PAGEError) != HAL_OK)
{ while (1) { BSP_LED_On(LED3); } }Address = FLASH_USER_START_ADDR;
while (Address < FLASH_USER_END_ADDR) { if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, DATA_64) == HAL_OK) { Address = Address + 8; } else { /* Error occurred while writing data in Flash memory. User can add here some code to deal with this error */ while (1) { BSP_LED_On(LED3); } } }HAL_FLASH_Lock();
Address = FLASH_USER_START_ADDR;
MemoryProgramStatus = 0x0;while (Address < FLASH_USER_END_ADDR)
{ data32 = *(__IO uint32_t *)Address;if (data32 != DATA_32)
{ MemoryProgramStatus++; } Address = Address + 4; }/*Check if there is an issue to program data*/
if (MemoryProgramStatus == 0) { /* No error detected. Switch on LED1*/ BSP_LED_On(LED1); } else { /* Error detected. Switch on LED2*/ BSP_LED_On(LED2); }