I get this exact error with the most recent master build and an STM32L052 and can confirm the 2nd invocation of `stm32lx_obl_launch()` as source. The processor isn't halted. However, when reexecuting openocd with `-c halt -c "stm32l0.cpu curstate"`, halting succeeds. I noticed that the CPU is in "running"-state even before the `write(OBL_LAUNCH)`, apparently since the end of `stm32lx_wait_until_bsy_clear_timeout()`. STM32CubeProgrammer is able to program this, although I regulary get a similar error there. The CPU seems to be in a certain state of execution when this happens, although I can't put in words what that state may be. But I assume whatever openocd does reliably puts the CPU into this state and thus always fails. I keep investigating.
--- ** [tickets:#247] STM32L031K6 (NUCLEO-L031K6): flash mass erase fails** **Status:** new **Milestone:** 0.9.0 **Created:** Sun Jul 28, 2019 01:51 PM UTC by Karolis M **Last Updated:** Mon Aug 05, 2019 08:27 PM UTC **Owner:** nobody **Attachments:** - [no_erase.log](https://sourceforge.net/p/openocd/tickets/247/attachment/no_erase.log) (35.0 kB; text/x-log) Hi, Log with debug-level messages attached. **Hardware: ** NUCLEO-L031K6 (using built-in STLink via micro USB) **OpenOCD**: 0.10.0+dev-00921-g263deb38 (self-built, unmodified source) **Invocation**: `src/openocd -d -s 'tcl/' -f 'board/stm32l0discovery.cfg' -c 'init; halt; wait_halt; stm32lx mass_erase 0; shutdown' -l no_erase.log` **Issue**: Invocation fails with `stm32lx mass erase failed` I narrowed the problem down slightly to 2nd invocation of `stm32lx_obl_launch()` (src/flash/nor/stm32lx.c:1340), with corresponding log entries starting at no_erase.log:413. If you require any more details or if I could help debugging this in anyway, do not hesitate to ask. Regards, Karolis --- Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is subscribed to https://sourceforge.net/p/openocd/tickets/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/openocd/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.