Hi,
Something wrong must be in your code or design at the reset pin (for example SBC chip connected)
please look at the code and measurement…. The code is made for DT256.
I suggest to toggle pin immediately in the COP routine to see how fast the wake up is.
! The measurement must be done with BDM interface disconnected !
- Blue = reset pin
- Yellow = PTA.0, … after PTA.0 is cleared COP is generated by writing CPMUARMCOP=0x00;
- Reset takes 8.5us then the MCU jump into the COP reset routine where PTA.0 is set
- The low level period of the yellow takes 15.5us. (Time between COP generated and wake up visualization at the pin)
BUSCLK is set for 8MHz.

//******************************************************************************
// File Name : Main.c
// Description : COP example
// $Version : 0.1.0.0$
// $Date : 2024-04-11$
//******************************************************************************
// The SW demonstrates COP watchdog using and MCU start after COP reset
// It uses COP interrupt vector which is called after COP reset and inside the
// COP interrupt it calls first program function _Startup() => Starts program from
// the beginning.
// The reset could be done in two ways on the base of enabled line in the Local
// definitions part of the code:
// a) COP is enabled and wait till its period is over
// b) COP is enabled and the MCU is immediately reset by writing a value
// to ARMCOP other than the COP reset value.
//******************************************************************************
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
//******************************************************************************
// CONDITIONAL COMPILATION SETUP
//******************************************************************************
#define HWA_ISSUE
//#undef HWA_ISSUE
//******************************************************************************
// Local definitions
//******************************************************************************
//******************************************************************************
// Local types definitions
//******************************************************************************
#define UBYTE unsigned char
#define SBYTE char
#define UWORD unsigned int
//******************************************************************************
#pragma DATA_SEG DEFAULT
//******************************************************************************
// Global variables
//******************************************************************************
static volatile UWORD j,k; // software delay constant
//******************************************************************************
#pragma CODE_SEG DEFAULT
//******************************************************************************
// Local functions definitions
//******************************************************************************
void main(void);
void _Startup(void);
//******************************************************************************
// WATCH DOG ISR
//******************************************************************************
#pragma CODE_SEG NON_BANKED
interrupt 2 void WatchDogIsr(void)
{
// WARNING: used wariable "j" has to be a global or static
// Note 1: port has to be set as an output again, since MCU was in reset
// Note 2: !!! stack pointer is not set after reset => any using stack before
// initialization can cause program crash
// (made inside the function _Startup)
// Note 3: Be aware that all registers are set to the RESET status. The RAM
// remains unchanged.
//--- Visualize COP reset on the port B diodes ---
// Note that you have to set the port as output, since MCU was in reset
PORTA = 0xFF; // set LEDs
DDRA = 0xff; // PTB as output
// for (j = 0;j < 0x20;j++) // wait to be able to recognize reset on the diodes
// { for(k=0;k<0xFFFF;k++) asm (nop);
// PORTA=~PORTA;
//
}
//--------------------------------------------
// run the program from the beginning
// startup code of the CodeWarrior S12 environment: void _Startup(void)
// located in the file Start12.c -> project tree directory: Startup Code
// you can us either this code (better solution)
asm JMP _Startup; // this code jumps to the _Startup
// or this code
// _Startup(); // this code leaves one address on the stack which
// has to be set because
}
//******************************************************************************
// MAIN
//******************************************************************************
#pragma CODE_SEG DEFAULT
void main(void)
{
//---------------------------------------
//--- Visualize start of main routine ---
PORTA = 0xFF;
DDRA = 0xff; // PORTB as output
PEAR_NECLK = 0; // BUSCLK at PE4
//--------------------------------------
for(;;)
{
for(j=0;j<255;j++)
{
for (j = 0;j < 0x01;j++) {for(k=0;k<0xFFFF;k++) { asm nop;}}
if(j=16)
{
COPCTL = 0x41; // enable COP
PORTA = 0x00;
ARMCOP = 0x00; // reset MCU immediately by means of COP
}
}
}
//--------------------------------------
while(1); // wait for COP reset
}
//--------------------------------------------------------------------------------------------------------------
Best regards,
Ladislav