cancel
Showing results for 
Search instead for 
Did you mean: 

I cant write to the FLASH OPTION register

YWhit
Associate III

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

2 REPLIES 2
TDK
Guru

> 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
Associate III

I’m waiting (41mS).

mass erase is a desired outcome

for me.

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

Yona