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
Solved! Go to Solution.
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!
-----------------------------------------------------------------------------------------------------------------------
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!
-----------------------------------------------------------------------------------------------------------------------
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
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 ->
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!
-----------------------------------------------------------------------------------------------------------------------