2020-04-24 06:23 AM
I'm trying to enable the OB_RDP_Level_1 for a STM32L151CC but It fails. The MCU becomes bricked. I can't even boot to DFU. I need to first start ST link utility and set read out protection level 0, and then do a chip erase.
But I noticed that bit OPTVERR = 1 indicating that the option bytes are faulty. I have tried a fulle chip erase and it does not set the OPTVERR to zero. Is it possible that I have a special STM32 that always start up with OPTVERR = 1?
I have tested on some evaluation boards and they have OPTVERR = 0 at start.
Solved! Go to Solution.
2020-04-27 03:21 AM
I solved the problem today. I was using STM32 Standard Peripheral Libraries V1.3.0. There was a bug in FLASH_OB_RDPConfig(). The FLASH_OB_RDPConfig() wrote the wrong option word to 0x1FF80000 (the bit 31:16 was not the inverse of bit 15:0).
I updated to the STM32 Standard Peripheral Libraries V1.3.1. So now it works. The bug was fixed in V1.3.1.
2020-04-24 09:02 AM
> I have tried a fulle chip erase and it does not set the OPTVERR to zero.
"Full chip erase" erases the flash. It doesn't touch the option bytes.
2020-04-27 03:21 AM
I solved the problem today. I was using STM32 Standard Peripheral Libraries V1.3.0. There was a bug in FLASH_OB_RDPConfig(). The FLASH_OB_RDPConfig() wrote the wrong option word to 0x1FF80000 (the bit 31:16 was not the inverse of bit 15:0).
I updated to the STM32 Standard Peripheral Libraries V1.3.1. So now it works. The bug was fixed in V1.3.1.