Can not erase flash memory page - a tab pops up when debugging
Hi, i have write a code to erase data of internal flash memory of the MCU. But when i debug it,a page(tab) pops up with the following message: No source available for "<signal handler called>() at 0xfffffffe" . And i can't any longer debug.
I use the MCU: STM32L4P5ZGTXP_FLASH
IDE: STM32CubeIDE STM32CubeIDE ,Version: 1.16.0
My code comes from an example code of STM32.
--------------AN EXTRACT OF THE CODE-------------
main.c
// if( __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() != HAL_OK)//added
// {
// BSP_Error_Handler(genFuncLTDC_TRANSFER_ERROR); //////////////////////////////////////////
// }
/* Unlock the Flash to enable the flash control register access *************/
HAL_FLASH_Unlock();
/* Erase the user Flash area
(area defined by FLASH_USER_START_ADDR and FLASH_USER_END_ADDR) ***********/
/* Get the 1st page to erase */
FirstPage = GetPage(FLASH_USER_START_ADDR);
/* Get the number of pages to erase from 1st page */
NbOfPages = GetPage(FLASH_USER_END_ADDR) - FirstPage + 1;
/* Get the bank */
BankNumber = GetBank(FLASH_USER_START_ADDR);
/* Fill EraseInit structure*/
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.Banks = BankNumber;
EraseInitStruct.Page = FirstPage;
EraseInitStruct.NbPages = NbOfPages;
if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)
{
/*
Error occurred while page erase.
User can add here some code to deal with this error.
PageError will contain the faulty page and then to know the code error on this page,
user can call function 'HAL_FLASH_GetError()'
*/
/* Infinite loop */
while (1)
{
/* Turn on LED3 */
BSP_LED_On(LED3);
}
}main.h
/*Defines for internal memory */
/*Table 8 Reference manual: Flash module - 1 Mbyte dual-bank organization, DB1M = 1
* (64 bits read width)
* Bank 1 is used
* */
#define FLASH_USER_START_ADDR ADDR_FLASH_PAGE_0 /* Start @ of user Flash area */
#define FLASH_USER_END_ADDR (ADDR_FLASH_PAGE_1 + FLASH_PAGE_SIZE - 1) /* End @ of user Flash area */
#define DATA_32 ((uint32_t)0x12345678) //enkel 2x 32 bit data schrijven is toegestaan
#define DATA_64 ((uint64_t)0x1234567812345678) //The Flash memory is programmed 72 bits at a time (64 bits + 8 bits ECC).
#define ADDR_FLASH_PAGE_0 ((uint32_t)0x08080000) /* Base @ of Page 0, bank 2 4 Kbytes */
#define ADDR_FLASH_PAGE_1 ((uint32_t)0x08081000) /* Base @ of Page 1, bank 2, 4 Kbytes */
#define ADDR_FLASH_PAGE_2 ((uint32_t)0x08082000) /* Base @ of Page 2, bank 2, 4 Kbytes */
----------------------END CODE-------------------------
The following code is put on comment since it isn't applicable for my MCU i think.:
// if( __HAL_FLASH_INSTRUCTION_CACHE_DISABLE() != HAL_OK)//added
// {
// BSP_Error_Handler(genFuncLTDC_TRANSFER_ERROR); //////////////////////////////////////////
// }
When debugging, the code hangs during execution of the following function:" if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)", on line 377(see picture below).
In function "HAL_StatusTypeDef HAL_FLASHEx_Erase()", the debugging stops(hangs) when trying to execute the code on line 125(see picture below) and the tab mentioned above appears. It even can't enter the function on line 125(function "FLASH_WaitForLastOperation()"). When we are on this function, then press "step into", the tab with the message appears.
The tab with the message that pops-up(appears), see picture below:
I have chosen pages(adresses) different than the MCU uses. Here below you can see(trough a Build Analyzer picture), wich adresses the MCU uses.
A picture of referance manual below:
Can someone help me? I need to use the internal flash memory to store data that isn't lost after the device is switched off.



