2009-06-23 12:33 PM
Using/testing the PVD interrupt.
2011-05-17 04:15 AM
I'm having trouble using the PVD interrupt to do stuff at power-down. The
interrupt doesn't seem to occur (can't debug during power-loss!) even when simulating it via software (calling PVD_Test()).Code:
PVD_init(void) { RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); PWR_PVDLevelConfig(PWR_PVDLevel_2V9); PWR_PVDCmd(ENABLE); ... EXTI_DeInit(); EXTI_StructInit(&exti_config); exti_config.EXTI_Line = EXTI_Line16; exti_config.EXTI_Mode = EXTI_Mode_Interrupt; exti_config.EXTI_Trigger = EXTI_Trigger_Rising; exti_config.EXTI_LineCmd = ENABLE; EXTI_Init(&exti_config); NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannel = PVD_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_Init(&NVIC_InitStructure); } PVD_IRQHandler(void) { ... Never get here! } PVD_Test() { EXTI_GenerateSWInterrupt(EXTI_Line16); }2011-05-17 04:15 AM
Solved it :) The problem was another
EXTI_DeInit(); line in another part of the program. That was undoing the initialization for EXTI_Line16 :-Y