AnsweredAssumed Answered

How to properly unlock a STM32F4xx device...

Question asked by poulin.jean_pier.001 on Dec 2, 2014
Latest reply on Dec 3, 2014 by Danish Ali
Hello ST gurus!

May I inquire on the right sequence of steps to unlock a device (level 1 lock) to unlocked (level 0)?

The STM library reveals the following sequence is required to lock:
FLASH_OB_Unlock();                        // Take the STM32F4xx from unlocked (level 0) to reversible lock (level 1)
FLASH_OB_RDPConfig(OB_RDP_Level_1);
FLASH_OB_Launch();

I assume the following code would unlock but it doesn't work!

FLASH_OB_Unlock();                        // Take the STM32F4xx from reversible lock (level 1) to unlocked (level 0) -> Does not work!
FLASH_OB_RDPConfig(OB_RDP_Level_0);
FLASH_OB_Launch();

When I run the unlock code below, the chip crashes (understandable as its Flash & memory is wiped) and the chip becomes invisible via JTAG.

The only way to revert the STM32 back to level 0 is by booting the device in DFU mode by shorting boot pins and lanuching the DFUSE utility to unprotect the device.

Can unlocking be done in code?  If DFUSE can do it I assume there is a magic sequence that can unlock a device by code running in Flash?

Thank you!!

   Jean-Pierre

Outcomes