Skip to main content
Associate II
August 24, 2023
Solved

how to erase a single page of flash memory

  • August 24, 2023
  • 2 replies
  • 10197 views

hello guys i need help with stm32f103 and stmcube ide

i want to erase a pege of flash memory during runtime of programme ,in my case i want to erase page no 63 i have found this following code in hal_flash_ex.c but i dont know how to use it or modify it to get result

HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError)

or may be i am trying a wrong hal function please help me

this function HAL_FLASH_ErasePage() is not available in my hal driver hal_flash.c or hal_flash_ex.c

thanks

This topic has been closed for replies.
Best answer by ahmash

this is solution and i found it at chatgpt 

HAL_FLASH_Unlock();

// 0x08000000 + (63 * 1024) = 0x0800FC00 //start byte address of page 63

FLASH_PageErase(0x0800FC00);

HAL_FLASH_Lock();

case closed thanks to all

2 replies

Tesla DeLorean
Guru
August 25, 2023
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
ahmashAuthorBest answer
Associate II
August 25, 2023

this is solution and i found it at chatgpt 

HAL_FLASH_Unlock();

// 0x08000000 + (63 * 1024) = 0x0800FC00 //start byte address of page 63

FLASH_PageErase(0x0800FC00);

HAL_FLASH_Lock();

case closed thanks to all