How to enable COP reset for MC9S12ZVM?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to enable COP reset for MC9S12ZVM?

ソリューションへジャンプ
1,235件の閲覧回数
young-kyunpark
Contributor II

How can I enable COP for MC9S12ZVM? or How can I jump to reset vector address when I need It?

 

Here is my configuration for COPCTL ;

 

CPMUCLKS_COPOSCSEL0 = 0;

  CPMUCLKS_COPOSCSEL1 = 1;

  CPMUCLKS_CSAD = 1;

  CPMUCOP_WRTMASK = 0;

  CPMUCOP_CR = 0x01;

  CPMUCOP_WCOP = 0;

  CPMUCOP_RSBCK = 1;

 

but, MCU working without reset.

 

regarding calling reset vector,

someone reply about jump to reset vector as follow

((void (*__near)(void))0xFFFE)();

but this line occurs syntex error.

ラベル(1)
1 解決策
859件の閲覧回数
iggi
NXP Employee
NXP Employee

Hi Young-kyun,

Watchdog is enabled by a write to the CPMUCOP register i.e. by writing a nonzero value to COP Watchdog Timer Rate Select bits - CR[2:0]. This action enables the COP counter and start the time-out period.
Below is a very simple code performing watchdog reset tested on S12ZVM EVB. The COP source clock is ACLK. The COP time-out period is set to maximum, so the time between two resets is around 13sec. This will be indicated by LED blink.

//******************************************************************************

// Main program

//******************************************************************************

void main(void) {

   

    unsigned int i;

   

    CPMUCLKS_COPOSCSEL1 = 1; // COP clock source is ACLK

 

     DDRS = 0xff;                             // Port S set as output   

     PTS  = 0x00;                             // LEDs off

 

  for(i=0; i<60000; i++)                    // delay

     {

         asm nop;

         asm nop;

         asm nop;

     }

 

     PTS  = 0xff;                             // LEDs on

 

    CPMUCOP = 0x47;                  // Enable watchodg 

  for(;;) {} /* wait forever */

 

}

Regarding the jump to reset vector, actually the address is 0xFFFC. You can also use "asm jmp _Startup;"

Regards,

iggi

元の投稿で解決策を見る

1 返信
860件の閲覧回数
iggi
NXP Employee
NXP Employee

Hi Young-kyun,

Watchdog is enabled by a write to the CPMUCOP register i.e. by writing a nonzero value to COP Watchdog Timer Rate Select bits - CR[2:0]. This action enables the COP counter and start the time-out period.
Below is a very simple code performing watchdog reset tested on S12ZVM EVB. The COP source clock is ACLK. The COP time-out period is set to maximum, so the time between two resets is around 13sec. This will be indicated by LED blink.

//******************************************************************************

// Main program

//******************************************************************************

void main(void) {

   

    unsigned int i;

   

    CPMUCLKS_COPOSCSEL1 = 1; // COP clock source is ACLK

 

     DDRS = 0xff;                             // Port S set as output   

     PTS  = 0x00;                             // LEDs off

 

  for(i=0; i<60000; i++)                    // delay

     {

         asm nop;

         asm nop;

         asm nop;

     }

 

     PTS  = 0xff;                             // LEDs on

 

    CPMUCOP = 0x47;                  // Enable watchodg 

  for(;;) {} /* wait forever */

 

}

Regarding the jump to reset vector, actually the address is 0xFFFC. You can also use "asm jmp _Startup;"

Regards,

iggi