Disabling Watchdog for 'Bare' Projects

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Disabling Watchdog for 'Bare' Projects

Disabling Watchdog for 'Bare' Projects

'Bare' (no PEx, no SDK) projects created with KDS V1.0.1 beta have the issue that the watchdog is not disabled (see KDS V1.0.1beta release notes).

This document explains how to disable the watchdog for the FRDM-KL25Z (steps are similar to other boards).

 

1. Add Derivative Header file

Add the derivative header file to your project. The header files are located in

C:\Freescale\KDS_1.0.1\eclipse\ProcessorExpert\lib\Kinetis\iofiles

Copy the matching header into the Startup_Code folder:

11461_11461.pngpastedImage_1.png

 

2. Disable Watchdog

Open startup.c and locate the function __init_hardware().

Include the derivative header file and the code to disable the watchdog:

11465_11465.pngpastedImage_3.png

 

This will disable the watchdog during startup. The above project is attached as a reference.

 

Code for the K64F

#define STARTUP_WDOG_STCTRLH_VALUE                     0x01D2U   /* WDOG_STCTRLH value */
#define STARTUP_WDOG_KEY_1                             0xC520U   /* Watchdog unlock key 1 */
#define STARTUP_WDOG_KEY_2                             0xD928U   /* Watchdog unlock key 2 */

 

void __attribute__ ((weak)) __init_hardware(void)

{

  /* Disable the WDOG module */

  WDOG_UNLOCK = (uint16_t)STARTUP_WDOG_KEY_1; /* Key 1 */

  WDOG_UNLOCK = (uint16_t)STARTUP_WDOG_KEY_2; /* Key 2 */

  WDOG_STCTRLH = (uint16_t)STARTUP_WDOG_STCTRLH_VALUE; /* Disable WDOG */

}

Labels (1)
Attachments
No ratings
Version history
Last update:
‎05-02-2014 01:35 AM
Updated by: