AnsweredAssumed Answered

MKW31Z512 and SDK2.2.1 - Watchdog (COP) doesn't work

Question asked by Giuliano Errico on Feb 10, 2020
Latest reply on Feb 11, 2020 by Sebastián Del Río

Hi all,


I am working on a project that uses the micro MKW31Z512 and I am having some problems with the watchdog (COP module). When I started, I used the SDK 2.2.0. The board had to use the bootloader and in the code, I found some instructions that disabled the watchdog. I removed them and added the enablement of it in the main application. Everything worked well. Then I was asked to migrate to the newer SDK 2.2.1 but I encountered some problems, because the watchdog doesn't work. I removed the same instructions in the bootloader project, thinking that it was enough, but I still can't reset the MCU. I can't find any other instructions about the COP so, can anyone tell me if there are any other instructions to remove/add in order to make it work? I'm using IAR Embedded Workbench for ARM 8.32.1.


Here is the code (used in both projects, with SDK 2.2.0 and 2.2.1):


BOOTLOADER (the part of the code that i removed):

#if defined(CPU_MKW24D512VHA5) || defined(MCU_MK21DX256) || defined(CPU_MK64FN1M0VLL12)
      WDOG->UNLOCK = 0xC520;
      WDOG->UNLOCK = 0xD928;
#elif defined(CPU_MKL46Z256VLL4) || defined(MCU_MKW40Z160) || defined(CPU_MKW41Z512VHT4)


MAIN APPLICATION (my configuration):

      cop_config_t cop_config;
      cop_config.enableWindowMode = false;
      cop_config.timeoutMode = kCOP_ShortTimeoutMode; //Derived from SDK1.3
      //cop_config.timeoutMode = kCOP_LongTimeoutMode;

      cop_config.enableStop = false;
      cop_config.enableDebug = true;
      cop_config.clockSource = kCOP_LpoClock;
      cop_config.timeoutCycles = kCOP_2Power10CyclesOr2Power18Cycles;
      COP_Init(SIM, &cop_config);


Another question (less important): In the previous SDK (2.2.0), the watchdog works only when the debug is not running, even if the flag (cop_config.enableDebug = true;) is set. Is there anything else to configure?


Thank you in advance!