Skip to main content
MSipo
Senior II
April 24, 2020
Solved

STM32L151CC with OPTVERR = 1

  • April 24, 2020
  • 2 replies
  • 1276 views

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.

This topic has been closed for replies.
Best answer by MSipo

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.

2 replies

TDK
Super User
April 24, 2020

> 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
MSipoAuthorBest answer
Senior II
April 27, 2020

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.