Skip to main content
JJ.Lin
Associate III
January 21, 2022
Question

STM32H7B0 FLASH_SR_RDPERR in HAL_FLASHEx_Erase_IT()

  • January 21, 2022
  • 2 replies
  • 1055 views

Hi,

Now the problem is FLASH->SR1 report FLASH_SR_RDPERR in HAL_FLASHEx_Erase_IT() and it failed to erase the BANK1 sector1 of address 0x8002000.I have checked the RDP is level0. What wrong with it ?And the code is here:

 HAL_FLASH_Unlock(); 
 
 flash_erase_init.TypeErase = FLASH_TYPEERASE_SECTORS;
 flash_erase_init.Banks = FLASH_BANK_1;
 flash_erase_init.Sector = 1;
 flash_erase_init.NbSectors = 1;
 HAL_FLASHEx_Erase_IT(&flash_erase_init);
 
 HAL_FLASH_Lock();

Thanks!

This topic has been closed for replies.

2 replies

TDK
January 25, 2022

Don't lock the flash until the operation completes. Use a blocking operation (HAL_FLASHEx_Erase) if you want to wait for it to complete.

There are other methods of locking flash memory other than RDP level. We don't have any insight into your hardware other than what you've posted here. Check PCROP settings.

"If you feel a post has answered your question, please click ""Accept as Solution""."
JJ.Lin
JJ.LinAuthor
Associate III
January 25, 2022

Thank you for your reply! I have found the final cause: UID byte read operation. UID address of STM32H7B0 is 0x08FF F800, and if you access it in uint8_t *, a hardfault may occur. It is okay to access in uint32_t *.

TDK
January 25, 2022

Reading the UID causes a flash operation to report RDPERR? That doesn't sound correct.

"If you feel a post has answered your question, please click ""Accept as Solution""."