Skip to main content
YWhit
Associate III
September 1, 2020
Question

I cant write to the FLASH OPTION register

  • September 1, 2020
  • 2 replies
  • 1135 views

Hi all

I need to write an external programmer for STM32G030J6.

I've written the SWD protocol, and I'm able to program all FLASH (if no protection applied).

the issue is: I can’t write to the FLASH OPTION: (changing protection level from 1 to 0)

I can’t convince RDP bits to become 0xAA (level0) (RDP is currently 00=LEVEL1) :

I'm trying it by using the steps described in "3.4.2: FLASH option byte programming".

if I'm running it externally as a debugger - then after writing the new value (step 2)- then the CPU doesn’t answer any more (SWD returns FAIL)

I've also tried- by downloading some simple SW into RAM and running it- still nothing.

(any other SW downloading to the RAM - works)

I've also tried to write to FLASH->OPTR. It also doesn’t want to change.  

ST-LINK is able to change from LEVEL1 to LEVEL0

SO:: what does ST-LINK do that I'm missing  ??

thanks for reading all this

Yona

This topic has been closed for replies.

2 replies

TDK
September 2, 2020

> if I'm running it externally as a debugger - then after writing the new value (step 2)- then the CPU doesn’t answer any more (SWD returns FAIL)

Changing the value from RDP 1 to RDP 0 triggers a full chip erase. Are you waiting until that's complete? Sounds like the chip is just busy erasing.

"If you feel a post has answered your question, please click ""Accept as Solution""."
YWhit
YWhitAuthor
Associate III
September 2, 2020

I’m waiting (41mS).

mass erase is a desired outcome

for me.

Can’t even change FLASH->OPTR under a standard debugger. 

Yona