Hi Mike, unfortunately this is a known problem. It is broken since merging https://review.openocd.org/c/openocd/+/6548 I proposed to revert this commit in https://review.openocd.org/c/openocd/+/6753 but no other maintainer voted for it. You may try to compile a custom OpenOCD version with the proposed revert and it should be able to program Kinetis Kx series MCUs with empty flash.
--- ** [tickets:#388] RESET/WDOG Loop Lockup with Kinetis MK22** **Status:** new **Milestone:** 0.11.0 **Created:** Wed Mar 22, 2023 12:17 AM UTC by Mike Aoun **Last Updated:** Wed Mar 22, 2023 12:17 AM UTC **Owner:** nobody I have developed a programmer application in Python for our products. The programmer has to program various things over various physical interfaces including images onto Microchip ATSAME70 family MCUs, Kinetis MK22 family MCUs and Altera FPGAs, using OpenOCD and an FTDI board behind the scenes. I have succeeded in getting the ATSAME70 MCUs and the Alteras programmed via OpenOCD. I can also program the MK22s via the FTDI board and OpenOCD, but only AFTER I have already programmed them once with a PE Micro MultiLink Universal adapter. However, I am unable to program pristine from the factory MK22s via the FTDI board and OpenOCD without this additional step and hardware expense. I have nSRST and nTRST connected. I am using the ft232h.cfg file for my interface and the kx.cfg file for my target. When I connect OpenOCD to the MK22 MCU I get messages about the MCU being "probably locked-up in RESET/WDOG loop." The message also includes the suggestion to issue the "kinetis mdm halt' command or if SRST is connected and configured to use "reset halt." It says further that if the MCU cannot be halted to issue the "kinetis mdm mass_erase" command. None of these seem to help me out any. When I issue "kinetis mdm halt" I get the message "Target not examined, reset NOT asserted!" When I issue the "reset halt" command I get essentially the same messages and suggestions that I received when I first connected OpenOCD to the MCU. When I issue the "kinetis mdm mass_erase" command I get a message telling me to press RESET (we don't have a reset button") and then it times out waiting for the reset button to be pressed. It goes on to suggest that I connect SRST (already connected) and use "reset_config srst_only" and retry. I type this in the telnet command line and then retry "kinetis mdm mass_erase". This time I do not get the press reset message and there is no timeout, but I still get the message "Target not examined, will not halt after reset!" After all of these things (tried serially and individually), I still do not have most of the OpenOCD functionality available and I still cannot write an image to flash. I am pretty new to OpenOCD and it's likely I'm just doing something wrong. I'm hoping one of you smart guys can tell me what it is that I'm doing wrong. Thanks. -Mike --- 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.