Generating LVD Warning Interrupts - KL36Z

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

Generating LVD Warning Interrupts - KL36Z

651 Views
tr9
Contributor II

We are using a KL36Z part, IAR tools, and SDK v1.3.0. We are trying to enter a low power mode when the LVD warning flag is set. This is a bare metal application.

To date we have been able to poll the Low-Voltage Warning flag and enter a low power mode. We have also been able to wake-up from this low power mode via an LLWU pin. The low power mode we are using is VLLS1.

Problem : We do not appear to be generating Low-Voltage Warning Interrupts, and\or enter the low power mode upon interrupt. The same code we used to enter the low power mode via polling is also used in our interrupt handler.

This is how we setup the LVD registers when we poll the LVD warning flag;

PMC_LVDSC1          = 0x01

PMC_LVDSC1 (LVDV)   = 1

PMC_LVDSC1 (LVDRE)  = 0

PMC_LVDSC1 (LVDIE)  = 0

PMC_LVDSC1 (LVDACK) = 0

PMC_LVDSC1 (LVDF)   = 0

PMC_LVDSC2          = 0x03

PMC_LVDSC2 (LVWV)   = 3

PMC_LVDSC2 (LVWIE)  = 0

PMC_LVDSC2 (LVWACK) = 0

PMC_LVDSC2 (LVWF)   = 0

PMC_REGSC           = 0x04

PMC_REGSC  (BGBE)   = 0

PMC_REGSC  (REGONS) = 1

PMC_REGSC  (ACKISO) = 0

PMC_REGSC  (BGEN)   = 0

This is how we setup the LVD registers when we want an LVD warning interrupt. The only difference from the polling example is that we set the interrupt enable pin, and we no longer poll for the flag (we wait for an interrupt).

PMC_LVDSC1          = 0x01

PMC_LVDSC1 (LVDV)   = 1

PMC_LVDSC1 (LVDRE)  = 0

PMC_LVDSC1 (LVDIE)  = 0

PMC_LVDSC1 (LVDACK) = 0

PMC_LVDSC1 (LVDF)   = 0

PMC_LVDSC2          = 0x23

PMC_LVDSC2 (LVWV)   = 3

PMC_LVDSC2 (LVWIE)  = 1

PMC_LVDSC2 (LVWACK) = 0

PMC_LVDSC2 (LVWF)   = 0

PMC_REGSC           = 0x04

PMC_REGSC  (BGBE)   = 0

PMC_REGSC  (REGONS) = 1

PMC_REGSC  (ACKISO) = 0

PMC_REGSC  (BGEN)   = 0

Other than enable the low voltage warning interrupt and establish an IRQ handler, are there other steps we need to take?

0 Kudos
Reply
1 Reply

424 Views
al_muir
NXP Employee
NXP Employee

What you have used for the Low Voltage Warning interrupt should work. The only other thing that should be required is enabling the PMC interrupt within the NVIC, as you would for any other module interrupt.

0 Kudos
Reply