Updated How to Unlock MCU Flash (markdown)

EmanuelFeru
2020-02-26 17:07:44 +01:00
parent 12ef5308da
commit bb15ced451

@@ -36,12 +36,12 @@ If you get funny, unexpected behavior from your board after flashing (see this [
* Step 1: Install the [ST-Flash Utility](https://github.com/texane/stlink) * Step 1: Install the [ST-Flash Utility](https://github.com/texane/stlink)
* Step 2: Install [OpenOCD](https://zoomadmin.com/HowToInstall/UbuntuPackage/openocd) * Step 2: Install [OpenOCD](https://zoomadmin.com/HowToInstall/UbuntuPackage/openocd)
* Step 2: Connect the ST-Link programmer to the MCU programming pins GND, SWDIO, SWCLK. Connect the 3V3 pin only if your MCU is not powered externally. * Step 3: Connect the ST-Link programmer to the MCU programming pins GND, SWDIO, SWCLK. Connect the 3V3 pin only if your MCU is not powered externally.
* Step 3: Open a terminal and send the following OpenOCD command: * Step 4: Open a terminal and send the following OpenOCD command:
``` ```
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c init -c "reset halt" -c "stm32f1x unlock 0" openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c init -c "reset halt" -c "stm32f1x unlock 0"
``` ```
* Step 4: If that does not work. Try: * Step 5: If that does not work. Try:
``` ```
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c init -c "reset halt" -c "mww 0x40022004 0x45670123" -c "mww 0x40022004 0xCDEF89AB" -c "mww 0x40022008 0x45670123" -c "mww 0x40022008 0xCDEF89AB" -c "mww 0x40022010 0x220" -c "mww 0x40022010 0x260" -c "sleep 100" -c "mww 0x40022010 0x230" -c "mwh 0x1ffff800 0x5AA5" -c "sleep 1000" -c "mww 0x40022010 0x2220" -c "sleep 100" -c "mdw 0x40022010" -c "mdw 0x4002201c" -c "mdw 0x1ffff800" -c targets -c "halt" -c "stm32f1x unlock 0" openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg -c init -c "reset halt" -c "mww 0x40022004 0x45670123" -c "mww 0x40022004 0xCDEF89AB" -c "mww 0x40022008 0x45670123" -c "mww 0x40022008 0xCDEF89AB" -c "mww 0x40022010 0x220" -c "mww 0x40022010 0x260" -c "sleep 100" -c "mww 0x40022010 0x230" -c "mwh 0x1ffff800 0x5AA5" -c "sleep 1000" -c "mww 0x40022010 0x2220" -c "sleep 100" -c "mdw 0x40022010" -c "mdw 0x4002201c" -c "mdw 0x1ffff800" -c targets -c "halt" -c "stm32f1x unlock 0"
``` ```