The mbed for FRDM-K64F firmware (http://mbed.org/handbook/Firmware-FRDM-K64F) has great potential. Unfortunately it seems that edges are still very rough: It happens very often that my FRDM-K64F board gets locked up :-(. I can see that the target CPU is constantly resetting: the red reset LED is always on:
That alone would not be bad, but OpenOCD is not able to connect to the CPU any more:
What now? Well, for such cases I have a P&E Multilink or Segger J-Link on my bench to get directly control over the running wild CPU:
Usually this works well, but with the mbed firmware on the Kinetis K20 of the FRDM-K64F board, this does not help: even the Segger J-Link had to give up:
The mbed debug application constantly resets the core. Even worse, sometimes the green J-Link LED turns red all the time too :-(.
What now? I have found two ways to recover from such a situation:
Workaround 1: Copy a ‘recovery’ binary file
It seems that the mbed bootloader is able to recover the Cpu if it programs a ‘good’ program with the MSD (Mass Storage Device) bootloader. For this, e.g. download the http://mbed.org/media/uploads/sam_grove/helloworld_k64f.bin and copy it to the MBED disk drive. That should get things under control again.
Workaround 2: Turn off K20 microcontroller running mbed Bootloader
Because it seems that the Kinetis K20 with the mbed debug application is interfering, the solution is to remove power from the K20. For this, instead powering the board through the OpenSDA connector, I power the board with the K64F USB connector:
Then I use the external debug cable to regain control of the K64F. After that I can re-power the K20.
The mbed bootloader and CMSIS-DAP application is not very stable (yet), so it could happen that downloading using CMSIS-DAP causes the processor and board to constantly reset, to the point that normal debugging is not possible any more. One solution is (if the mbed bootloader is still active) to copy a dummy file so the K64F gets reprogrammed trough the bootloader. The other approach is to remove power from the K20, and then connect and flash the K64F with an external debug cable.
Happy Recovering 🙂