I'm studying about STM32 low power modes, and after program the device with __Wfi
instruction I cant program another firmware in the device, I tried to use the STM utility to erase the code, but it show that the flash had write protection.
The first error that show is :
adapter speed: 24000 kHz adapter_nsrst_delay: 100 Info : clock speed 24000 kHz Info : STLINK v2 JTAG v34 API v2 SWIM v7 VID 0x0483 PID 0x3748 Info : using stlink api v2 Info : Target voltage: 3.192646 Error: init mode failed (unable to connect to the target) in procedure 'program' in procedure 'init' called at file "embedded:startup.tcl", line 495 in procedure 'ocd_bouncer' ** OpenOCD init failed ** shutdown command invoked
After a search, I found that I can get the firmware putting the boot0
in VCC, so I did this, and the follow error was shown:
** Programming Started ** auto erase enabled Info : device id = 0x10076413 Info : flash size = 512kbytes Error: stm32x device protected Error: failed erasing sectors 0 to 0 embedded:startup.tcl:476: Error: ** Programming Failed **
My board has a stm32f407vet6 processor. I'm using a ST-LinkV2 clone, for download and debug purposes.
-
1\$\begingroup\$ STM32's do have a habit of locking themselves for odd reasons. You probably need to run the unprotect sequence which includes a full power cycle. Because I/O's can leak power in, it's generally best to disconnect everything when you do the power cycle. \$\endgroup\$Chris Stratton– Chris Stratton2020年05月19日 00:22:21 +00:00Commented May 19, 2020 at 0:22
-
\$\begingroup\$ Im begginer with arm development so i dont know what is this. Is it a new firmware that a have to download? I dont find any material related to this. \$\endgroup\$Bruno Otavio– Bruno Otavio2020年05月19日 15:06:57 +00:00Commented May 19, 2020 at 15:06
-
\$\begingroup\$ Unprotecting is an operation of a tool like OpenOCD or its competitors, which must be followed by a complete power cycle for which it is best to remove all connections to the board. \$\endgroup\$Chris Stratton– Chris Stratton2020年05月19日 15:12:24 +00:00Commented May 19, 2020 at 15:12
1 Answer 1
For those who face the same problem, i solved this using st-link utility
1)First go to settings and change the connection setting to jtag.
2)Upgrade de firmware, change back to SWD.
3)Go to option bytes, put Read Out Protection in Level 0 and unselect all sectors(this will disable the protection and allow the flash to be erased).
After some research i found that "low power modes disable the debugger and some other parts of the circuitry that i try to communicate with" (Author: clive1, in https://community.st.com/s/ )