I am currently working on a standalone STM32F4 based board (STM32F469). So far, everything worked fine. I was programming my microcontroller through ST-Link Utility with the STM32F4-DISCOVERY ST-Link via SWD.
Friday, when I left the work, everything was working well. This morning when I came back to my office, my program didn't start on the board. When I tried to connect to the STM32F4 via SWD, the STM32 ST-Link Utility displayed a warning saying :
Can not read memory! Disable Read Out Protection and retry
I did not set anything though. I did some researches and I try some things :
- Change the Option Bytes in Target > Option Bytes > Read Out Protection. I don't know if it is relevant of the actual RDP state but when I open this tab, the RDP is on Level 1. When I set it to 0 and click on Apply, after few seconds an error is displayed saying Could not set Option bytes! Please reset the target and retry.
- I tried to erase the chip. Of course it did not work since the RDP is set.
- I have updated the ST-Link firmware. I did not update the STM32 ST-Link Utility since till now is worked well (v4.0.0.0). I did not change anything.
- I tried to connect to the chip under reset. Sounds good, doesn't work.
I don't know what to do else. When I read the Reference Manual of my STM32F4 (RM0386), page 87 we can read :
Level 1: read protection enabled.
It is the default read protection level after option byte erase. The read protection Level 1 is activated by writing any value (except for 0xAA and 0xCC used to set Level 0 and Level 2, respectively) into the RDP option byte. When the read protection Level 1 is set:
- No access (read, erase, program) to Flash memory or backup SRAM can be performed while the debug feature is connected or while booting from RAM or system memory bootloader. A bus error is generated in case of read request.
- When booting from Flash memory, accesses (read, erase, program) to Flash memory and backup SRAM from user code are allowed.
When Level 1 is active, programming the protection option byte (RDP) to Level 0 causes the Flash memory and the backup SRAM to be mass-erased. As a result the user code area is cleared before the read protection is removed. The mass erase only erases the user code area. The other option bytes including write protections remain unchanged from before the mass-erase operation. The OTP area is not affected by mass erase and remains unchanged. Mass erase is performed only when Level 1 is active and Level 0 requested. When the protection level is increased (0->1, 1->2, 0->2) there is no mass erase.
First of all, is it possible that the RDP may have been activated by somehow supernatural phenomenon ? I swear I DID NOT set this bit. Plus, as I can read for the Level 1 description, it is posible to come back to Level 0 (but the user program is erased). For me, to go from Level 1 to Level 0 doesn't work. So.... I am afraid that the RDP level is actually 2 and in this case..... well I am dead.
Is there anyway to solve this ? I don't understand what could have change during the week-end since everything was working fine and now everything don't.
Thanks in advance.