Watchdog reset using PE Micro MULTILINK Universal FX debugger

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

Watchdog reset using PE Micro MULTILINK Universal FX debugger

484 Views
heshamyassin
Contributor I

I'm using MC9S12ZVL128 and I want to test whether Watchdog is functioning normally (Resetting) using PE Micro Multilink Universal FX debugger. 

0 Kudos
Reply
1 Reply

338 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

the WDT functionality is more difficult to test because debugger losts communication after reset and it is not synchronized.

The best way is to use different appoach, in simpple words we use, "blink the diode" or put some signal at the pin. This is standard approach we use.

As an example, here is one my code "Reset source recognition - S12ZVL":

//------------------------------------------------------------------------------
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
//------------------------------------------------------------------------------
#define LED_ID_BLUE          1
#define LED_ID_BLUERED       4
#define LED_ID_BLUEGREEN     6

#define LED_ID_RED           3
#define LED_ID_REDBLUE       4
#define LED_ID_REDGREEN      8

#define LED_ID_GREEN         5
#define LED_ID_GREENBLUE     6
#define LED_ID_GREENRED      8

#define LED_ID_BLUEREDGREEN  9

#define LED_BLUE             PTP_PTP1
#define LED_RED              PTP_PTP3
#define LED_GREEN            PTP_PTP5
#define ON                   0
#define OFF                  1
#define LED_OFF_BLUE         PTP_PTP3 = OFF;
#define LED_OFF_RED          PTP_PTP1 = OFF;
#define LED_OFF_GREEN        PTP_PTP5 = OFF;
#define LED_ON_BLUE          PTP_PTP3 = ON;
#define LED_ON_RED           PTP_PTP1 = ON;
#define LED_ON_GREEN         PTP_PTP5 = ON;
//------------------------------------------------------------------------------
void blink(unsigned char led_id, unsigned long rpt, unsigned long dly);
void delay(unsigned long dly);
//------------------------------------------------------------------------------
void blink(unsigned char led_id, unsigned long rpt, unsigned long dly)
{
  rpt = rpt * 2;
 
  while(rpt--)
     {
       // blue   
       if(led_id == LED_ID_BLUE || led_id == LED_ID_BLUERED || led_id == LED_ID_BLUEGREEN || led_id == LED_ID_BLUEREDGREEN)  
                            LED_BLUE = (LED_BLUE == 1) ? 0 : 1;    

       //red
       if(led_id == LED_ID_RED || led_id == LED_ID_REDBLUE || led_id == LED_ID_REDGREEN || led_id == LED_ID_BLUEREDGREEN)  
                            LED_RED  = (LED_RED == 1) ? 0 : 1;    

       //green
       if(led_id == LED_ID_GREEN || led_id == LED_ID_GREENBLUE || led_id == LED_ID_GREENRED || led_id == LED_ID_BLUEREDGREEN)  
                            LED_GREEN = (LED_GREEN == 1) ? 0 : 1;    

       delay(dly);
     }
}
//------------------------------------------------------------------------------
void delay(unsigned long dly)
{
  while(dly--)
            asm nop;
}
//------------------------------------------------------------------------------
void main(void)
{
  //-------------------------------
  DDRP_DDRP1 = 1;                  //LEDBLUE  PORT
  DDRP_DDRP3 = 1;                  //LEDRED   PORT
  DDRP_DDRP5 = 1;                  //LEDGREEN PORT
  //-------------------------------
  LED_OFF_BLUE;
  LED_OFF_RED;
  LED_OFF_GREEN;
  //-------------------------------
  blink(LED_ID_BLUE,1,0x1FFFF);
  blink(LED_ID_BLUERED,1,0x1FFFF);
  blink(LED_ID_BLUEGREEN,1,0x1FFFF);
  blink(LED_ID_RED,1,0x1FFFF);
  blink(LED_ID_REDGREEN,1,0x1FFFF);
  blink(LED_ID_GREEN,1,0x1FFFF);
  blink(LED_ID_BLUEREDGREEN,1,0x1FFFF);
//-------------------------------
  if (CPMURFLG_COPRF)
    {
       blink(LED_ID_BLUE,5,0x3FFFF);
    }
  //-------------------------------
  if (CPMURFLG_PORF)
    {
       blink(LED_ID_RED,5,0x1FFFF);
    }
  //-------------------------------
  CPMURFLG = 0x6B; //clear all flags

  for(;;)
   {
      CPMUCOP=0x07;             //init COP watchdog
      CPMUARMCOP=0x00;          //immediate reset MCU
    
   }
  //-------------------------------
}
//------------------------------------------------------------------------------

Best regards,

Ladislav

0 Kudos
Reply