I've been working on getting an SWD dongle working. So far I've managed to program the flash on a KE04, but moving on to some KL26's I ran into some trouble. I've been following the instructions here under SWD mass erase. Here is the procedure that I've been doing:
- 5V is applied to the internal 3.3V regulator and the 3.3V is ran into the VDDs
- The reset line is tied to ground
- I read the IDCODE register from the SWD and it is correct.
- I read the MDM-AP status reguster and it reads 0x36. I've interpreted this to mean mass erase is enabled, the device is secured, and the flash is ready.
- I write the MDM-AP control register with 0x1 which I believe should start the mass erase procedure
- I read MDP-AP control repeatedly waiting for the 0th bit to clear. There is about 0.1s between reads of this register
The issue I've been having is that the last step goes on for a long time (indefinitely it seems, but I've only tested it for a couple minutes). This procedure worked fine to un-secure on a KE04 (except I didn't have to tie reset low). I'm hoping that somebody might know some detail about the differences between the mass erase procedure via SWD between KE04 and KL26 devices and that perhaps I'm doing something wrong.
Is it also possible the device has been damaged while soldering it to my board? The chip has never been programmed before, so I would have expected it to come in a non-secure state.