cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L151CC with OPTVERR = 1

MSipo
Senior II

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.

1 ACCEPTED SOLUTION

Accepted Solutions
MSipo
Senior II

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.

View solution in original post

2 REPLIES 2
TDK
Guru

> 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.

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

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.