K64 Low Voltage Detect

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

K64 Low Voltage Detect

跳至解决方案
2,296 次查看
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

标记 (4)
1 解答
1,727 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

在原帖中查看解决方案

4 回复数
1,728 次查看
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!
-----------------------------------------------------------------------------------------------------------------------

1,726 次查看
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

1,726 次查看
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 项奖励
1,726 次查看
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 项奖励