S12ZVL LVI interrupt and voltage levels to triggers interrupt

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

S12ZVL LVI interrupt and voltage levels to triggers interrupt

1,178 Views
charudattaingal
Contributor IV

Hello Team,

Please share the example code for s12zVL LVI enable code.

I have gone through data sheet, I have not seen LVI triggered voltage level are configurable.

Let me know is there any way to configure LVI triggers voltage level apart from below mentioned Values ? 

pastedImage_1.png

Thanks You !

Best Regards,

Charudatta

Tags (1)
0 Kudos
Reply
3 Replies

1,026 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello,

The LVI level is not configurable.

But the MCU has BATS module that can monitor VSUP voltage and trigger Low or High voltage warning interrupts.

Please refer to Appendix F BATS Electrical Specification, S12ZVL RM rev.2.47.

BR, Daniel

0 Kudos
Reply

1,026 Views
charudattaingal
Contributor IV

Hello Daniel,

Thank you for quick response.

Please share the LVI example code.

Thanks & Regards,

Charudatta

0 Kudos
Reply

1,026 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Charudatta,

I'm sorry for the delay.

You can refer to the code below, tested on S12ZVLA12.

BR, Daniel

interrupt VectorNumber_Vlvi void LVI_ISR(void)
{
 
  // Interrupt indicated by flag LVIF = 1 
  // is triggered by any change of the status bit LVDS if interrupt enable bit LVIE = 1
  if(CPMULVCTL_LVDS)
  {  // [3] LVDS = 1 Input voltage VDDA is below level VLVIA and FPM.
     asm BGND; // Breakpoint, do something here
  }
  else
  {  // [3] LVDS = 0 Input voltage VDDA is above level VLVID or RPM (Stop mode).
     asm BGND; // Breakpoint, do something here
  } 
 
  CPMULVCTL_LVIF = 1; // Clear LVIF

}

void delay(volatile int i)
{
  while(i--);
}

void main(void) 
{
  EnableInterrupts;
  /* include your code here */
 
  CPMUVREGCTL = 0x81; 
  // [8] VREG5VEN = 1b Voltage regulator 5 Volt operation enabled
  // [1] EXTXON = 0b External ballast transistor disabled
  // [0] INTXON = 1b Internal ballast transistor enabled
 
  delay(1000); // VDDA is rising to 5V
 
  CPMULVCTL |= 0x01; // Clear LVIF 
  CPMULVCTL |= 0x02; // Enable LVI
 
  for(;;) 
  {
     __RESET_WATCHDOG(); /* feeds the dog */
 
  } /* loop forever */
    /* please make sure that you never leave main */
}
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
Reply