Unbricking KL25Z after setting reset pins as GPIO

The KL25Z has one push button, which is used as reset switch. You can make this a general GPIO input, allowing you to use the switch as general user switch.

The only small issue: the interface IC also uses this to reprogram the KL25Z. Which won't reprogram if it cannot reset the KL25Z. Congratulations, you just bricked your device :).

The LPC mbeds can be unbricked simply by holding reset while plugging it in your PC. The KL series then enters bootloader. Worse, it seems the KL25 doesn't care that I hold reset, and happily runs the original program. Now there are probably different things you can do, but since I have KEIL uVision 5 installed, I used that. First of all you need the flash algorithms (uVision 4 should have them by default), which can be found here: http://www.keil.com/download/files/mdkcm500.exe. Now you can flash pretty much every ARM device.

If you export a random KL25Z project to Keil you should have the correct device selected, so you don't need to worry about that. I don't know if the next step is required, but it made sense, and I am not willing to brick it again to try if it is really needed. Go to Project -> Options for target. Go to debug tab, where at the right top the CMSIS-DAP debugger should be selected (you might need to plug in your mbed to get it there by default). Click on settings, and on the bottom you got some reset options. Now I expected a HW reset isn't going to work, so I picked randomly the sysresetreq.

Close all your windows, and go to Flash > Erase. Now you should happily see that your KL25 isn't doing anything, since nothing is on it anymore :). And next time, don't abuse the reset switch as regular switch.


Please log in to post comments.