Thursday, January 18, 2018

Problem in Debugging Kinetis K60 or K28F or K27

Problem:

When adding some code in the program, it becomes impossible to debug or error occurs in debug.

Solution:

You have to add flash configuration field in your program as follows. Otherwise, the MCU become secured and the debug functionality is disabled.

/* Flash Configuration Field */
const unsigned bytes flashconfig[16] __attribute__((section(".ARM.__at_0x400"))) =
    { 0xFF,0xFF,0xFF,0xFF,
      0xFF,0xFF,0xFF,0xFF,
      0xFF,0xFF,0xFF,0xFF,
      0xFE,0x3D,0xFF,0xFF };

Hope this is helpful. Enjoy debugging!