2022-05-25 01:11 PM
I had no issue writing to and erasing the banks on my nucleo a couple times but all of a sudden it started failing. I unlock the flash successfully clear flash error flags and try do a bank erase:
FLASH_EraseInitTypeDef erase;
erase.TypeErase = FLASH_TYPEERASE_MASSERASE;
erase.Banks = bank_to_erase;
if(HAL_FLASHEx_Erase(&erase, &err) != HAL_OK) {
uint32_t retcode = HAL_FLASH_GetError();
}
retcode gets set to 0x20000 which corresponds to PEMPTY flag. However the area (bank 2) which I try to erase is not empty when i look at it with StmCubeProgrammer. Furthermore, although I see HAL_FLASH_GetError() return 0x20000 looking at SFR for Flash in the debugger does not show PEMPTY set:I'm not sure if OB are important here but these are my current settings:
Any pointers or ideas appreciated. Thank you.
2022-05-26 01:58 AM
Hello @devtty ,
Thank you for your feedback,
I suggest checking the WRP Option Bytes .
If the write protection is disabled for bank 2, could you try to do the erase using CubeProgrammer and see if it works ?
Your response will better help us in diagnosing the issue.
Best regards,
Aziz
2022-05-26 07:49 AM
Hello thank you for the respone. Within stcube programmer here are my values:
I have done a full chip erase a couple times now.
Thanks.
2022-05-31 07:02 AM
Hello, are there any updates on this? Thanks!