Watchdog, writing flash on Kinetis m0+ with Codewarrior + J-Link

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • Watchdog, writing flash on Kinetis m0+ with Codewarrior + J-Link

    I am trying to debug a simple test application on a Freescale KL05 microcontroller using CodeWarrior10.6 and a J-Link. I have identified 2 issues that seem to be related to the J-Link, and was wondering if there was a workaround for them.

    First, my application needs to use the Watchdog timer, but as I understand from reading the J-Link user guide, when detecting a Kinetis device, j-Link performs a reset type 6 which disables the watchdog. This is disastrous as the Kinetis provides no mechanism to reenable the watchdog after it has been disabled. Is there a way to change the default J-Link behavior so that it executes a reset type 0 which does not have this undesirable side effect? My code will be responsible for keeping the watchdog alive.

    Second, it seems that when using the J-Link I am prohibited from using the Kinetis internal flash memory controller to update the flash contents. I can program the registers on the Kinetis FMC and the write/erase procedure is reported to succeed, but it would seem that the J-Link is ultimately somehow blocking the flash write from taking place. A friend of mine who gave me the example code is using a MultiLink PE device and the code works perfectly, so I know it is not a coding bug. The only difference between our setups is the J-Link.

    Can anyone here suggest how to correct these issues? I have read all the documentation I can find, but I haven't seen any discussion on it. If there is a thread or a document somewhere that I have missed I apologize.

    Any advice or assitance is appreciated.
  • Regarding your first issue. There must be a way to set the reset type in Code Warrior wherever you configure your debugger. In IAR there is the notion of a 'normal' reset type which maps to JLink's reset type 0--effectively let JLink decide which is best which I suppose is type 6. See the section "Strategies for Cortex-M Devices" in the JLink manual.

    If you wrote a JLink script you could select the device and the use 'rsettype' to set it explicitly but I'd be surprised if there is not a better way to do this in Code Warrior.

    K