AnsweredAssumed Answered

Reset read protection in STM32F205

Question asked by Jack Peacock on Nov 1, 2012
Latest reply on Jul 4, 2016 by Clive One
I turned on a test board this morning and could not program or read the flash area (0x0000 0000 to 0x1FFF FFFF).  Looking at the option bytes in FLASH_OPTCR register I see the RDp field set to FF, level 1 protection enabled.  Mystery how it was set but okay, I'll try to reset it back to level 0.  JTAG is working and I can access SRAM and registers.  CPU is an STM32F205VF.

Using a JLINK and gdb I sent this command sequence to the FLASH registers:
monitor memu32 0x40023c08 = 0x08192a3b    1st OPTKEYR to unlock
monitor memu32 0x40023c08 = 0x4c5d6e7f     2nd OPTKEYR to unlock
(at this point if I look at OPTCR it shows as unlocked, OPTSR shows not busy)
monitor memu32 0x40023c14 = 0x0fffaaee      no write prot, level 0 read prot, start
(I wait about 30 seconds, should be doing a mass erase)
monitor memu32 0x40023c14
  return 0x0FFF FFED            read protection still at level 1

I power down and back up, read protection still set to FF.

I also tried the JLINK utility JlinkSTM32.exe, to clear read protection.  It returns an error "resetting option byte failed".  Seems to be the same problem.

I'm not at the irreversible level 2, because JTAG still works and I can dump memory except for the flash region.  But I can't clear read level 1 back to level 0.

Any idea how to clear the read protection?   Has anyone else encountered this problem?  The read level changed between power off at 5pm and power on at 8am the next day.  The application code in the flash doesn't modify the option byte.
  Jack Peacock

Outcomes