MKE18F512VLL16 LVW Interrupt

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

MKE18F512VLL16 LVW Interrupt

577 Views
lifeng
Contributor II

I want use LVW interrupt  to detect power off and save some data to eerpom(flexNVM), but the it can't into LVD_LVW_IRQHandler.

Set breakpoint in LVD_LVW_IRQHandler, in debug mode , power off MCU, the program can't run to breakpoint ;

Set breakpoint in HardFault_IRQHandler, in debug mode , power off MCU, the program also can't run to breakpoint ;

pastedImage_1.png

pastedImage_2.png

pastedImage_3.png

pastedImage_4.png

After power off the MCU, the +5V power can keep 1ms from 4V to 3V, why it can't work into interrupt?

Or how to store some status data at the power off ?

This is the configration LVW Interrupt code.

void low_voltage_warning_config(void)
{
   pmc_low_volt_detect_config_t             lvds_lvd_config;
   pmc_low_volt_warning_config_t          lvds_lvw_config;

   lvds_lvd_config.enableInt = true ;
   lvds_lvd_config.enableReset = false ;
   lvds_lvw_config.enableInt = true ;
 

  PMC_ConfigureLowVoltDetect(PMC, &lvds_lvd_config);
   PMC_ConfigureLowVoltWarning(PMC, &lvds_lvw_config);
   EnableIRQ(LVD_LVW_IRQn);
}

At the beginning of the program , set LVD_LVW_IRQn priority is 0.

NVIC_SetPriority( LVD_LVW_IRQn , 0);

void LVD_LVW_IRQHandler(void)
{
   bool lvdf_status;
   bool lvwf_status;

   lvdf_status = PMC_GetLowVoltDetectFlag( PMC );
   lvwf_status = PMC_GetLowVoltWarningFlag( PMC );

   if( lvdf_status ) PMC_ClearLowVoltDetectFlag( PMC );
   if( lvwf_status ) PMC_ClearLowVoltWarningFlag( PMC );

   if( lvwf_status || lvdf_status )
   {
      flash_eeprom_write_4_byte( software_ver_address, 1101 ); 
   }

   PRINTF("MCU power low and system halt \r\n");
   while(1);

}

Labels (1)
Tags (1)
0 Kudos
2 Replies

414 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, Lifeng,

I suspect that the debugger takes a long time to enter the ISR, can you just turn on a LED in ISR so that you know that the mcu entered the ISR when power off?

BR

Xiangjun Rong

0 Kudos

414 Views
lifeng
Contributor II

Hi, Xiangjun Rong

      After add a 470uF CAP to the MCU power, the LVW Interrupt work well .

      After power off the MCU, the power can keep 5ms from 4V to 3V.

pastedImage_1.png

0 Kudos