K64 Low Voltage Detect

cancel
Showing results for 
Search instead for 
Did you mean: 

K64 Low Voltage Detect

Jump to solution
1,187 Views
johnbaker
Contributor IV

I am trying to activate the Low Voltage detect on the K64 chip.  I have tried several variations of the control register configurations below but with no luck.  Does anybody know how to get the LVD_LVW interrupt to fire when the voltage drops below 3.1v?

PMC_LVDSC1 =  PMC_LVDSC1_LVDIE_MASK | PMC_LVDSC1_LVDV(1);

PMC_LVDSC2 =  PMC_LVDSC2_LVWIE_MASK | PMC_LVDSC2_LVWV(3);

void LVD_LVW_IRQHandler(void) {

}

Thanks,

John Baker

1 Solution
618 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello John Baker:

I think you are missing to enable the LVD/LVW interrupt vector from the NVIC module, apart from enabling the interrupts in the PMC module. Also, as noted in the Reference Manual, the LVWF flag may be 1 after power-on reset, so you must clear it by writing 1 to LVWACK.

Try with this code:

    PMC_LVDSC1 =  PMC_LVDSC1_LVDIE_MASK | PMC_LVDSC1_LVDV(1);

    PMC_LVDSC2 =  PMC_LVDSC2_LVWACK_MASK | PMC_LVDSC2_LVWIE_MASK | PMC_LVDSC2_LVWV(3);

    NVIC_EnableIRQ(LVD_LVW_IRQn);

Then as noticed by Alice the voltage threshold with these settings is not exactly 3.1 V, but 3V for Low Voltage Warning and 2.56V for Low Voltage Detect.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

4 Replies
619 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello John Baker:

I think you are missing to enable the LVD/LVW interrupt vector from the NVIC module, apart from enabling the interrupts in the PMC module. Also, as noted in the Reference Manual, the LVWF flag may be 1 after power-on reset, so you must clear it by writing 1 to LVWACK.

Try with this code:

    PMC_LVDSC1 =  PMC_LVDSC1_LVDIE_MASK | PMC_LVDSC1_LVDV(1);

    PMC_LVDSC2 =  PMC_LVDSC2_LVWACK_MASK | PMC_LVDSC2_LVWIE_MASK | PMC_LVDSC2_LVWV(3);

    NVIC_EnableIRQ(LVD_LVW_IRQn);

Then as noticed by Alice the voltage threshold with these settings is not exactly 3.1 V, but 3V for Low Voltage Warning and 2.56V for Low Voltage Detect.


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

618 Views
johnbaker
Contributor IV

Jorge,

This worked like a champ! 

The interrupt fires at 3.06v and my critical backup to flash takes around 600 us.  Life is good again! :-)

Thanks,

John Baker

618 Views
johnbaker
Contributor IV

Thanks Alice and Jorge.  I will try this.  Our chip runs at 3.3v.

Alice, the Datasheet 2.2.2 page looks same as what you posted.

Jorge,  I will try your code sample out and let you know how it works for me.

Thanks again!

John Baker

0 Kudos
618 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello John,

What is your voltage of low voltage ? It is not only under 3.1 the low voltage can detected.

You can find information regard VLVDL and VLVDH on the K4 datasheet :

2.2.2 LVD and POR operating requirements ->

pastedImage_0.png

pastedImage_1.png

Please check the voltage of your chip .


Have a great day,

Alice

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos