I don't know why my ISR_63_LVI interrupt function has't been triggered

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

I don't know why my ISR_63_LVI interrupt function has't been triggered

637 Views
wojinandawei
Contributor II

1、show my code:

in main:  VREGCTRL_LVIE = 1; 

in IRS:

interrupt 63 void ISR_63_LVI (void)
{
      word wdtmpt0 = 0x8888;
      (void)CAN0_Trans((byte * )MetrBackID_Tab,(byte *)&wdtmpt0,2,&byCAN0Priority);
      DisableInterrupts;

VREGCTRL_LVIF = 1;//clear flag

//buf[0] = 0x6666;
if(VREGCTRL_LVDS) // Input voltage VDDA is below level VLVIA and FPM.
{

}

EnableInterrupts;

}

PROBLEM:when i shut down the system power , the LVI interrupt function ISR_63_LVI is not triggered。

I dont know why.F0000TEK.JPG

Labels (1)
0 Kudos
2 Replies

494 Views
lama
NXP TechSupport
NXP TechSupport

Hi,

It would be suitable aslo mention which MCU you use. I suppose some of S12X devices.

LVi is recognized only in if voltage drops down typically under 4.23V. The recognition of LVI, of course, requires operational voltage 5V (I can see you use).

My question is, how the system works if you decrease Vdda voltage under LVI assert level?

Have you enabled I bit maskable interrupts.

I have successfully tested following code:

// Tested on demo9s12XEP100 board, regulated voltage is connected to J502 pin 2. Gnd is connected  J101.3

//==============================================================================

#include <hidef.h>      /* common defines and macros */

#include "derivative.h"      /* derivative-specific definitions */

//==============================================================================

void main(void)

{

  DDRA  = 0xFF;

  PORTA = 0xFF;

  PORTA = 0x00;

  //----------------------------------------

  VREGCTRL = VREGCTRL_LVIE_MASK;            // enable LVI interrupt

  //----------------------------------------

  EnableInterrupts;        // or asm CLI;   // in order to enable maskable interrupts  (LVI)

  //----------------------------------------

  for(;;)

  {

    asm nop;

  }

  //----------------------------------------

}

//==============================================================================

// it jumps to \XIRQ interrupt while \XIRQ is 0

//==============================================================================

#pragma CODE_SEG NON_BANKED

//==============================================================================

// it jumps to LVI interrupt everytime and only when LVDS changes

//==============================================================================

#pragma CODE_SEG NON_BANKED

interrupt 63 void LVIisr(void)

{

 //unsigned int i,j;

 

 // put your code here

 PORTA = (VREGCTRL_LVDS) ? 0x55 : 0x33; // show current voltage level of VDD on the port B

   

 VREGCTRL |= VREGCTRL_LVIF_MASK; // clear LVI interrupt flag and do not change "enable LVI interrupt"

 

 // let's consider VDD=5V and it falls down under LVI assert level => isr is generated =>

 // => LVDS=1, LVIE=1, LVIF=1. After clearing interrupt flag and leaving the interrupt subroutine

 // is not generated again till LVDS changes (rises over the LVI deassert level)

}

#pragma CODE_SEG DEFAULT

//==============================================================================

Best regards,

Ladislav

0 Kudos

494 Views
wojinandawei
Contributor II

in fact, the ISR function is triggered already, it  just didn't sent can message out。

May be the can transfer chip has different abilitys with my old chip ATA6600.

0 Kudos