cancel
Showing results for 
Search instead for 
Did you mean: 

Using/testing the PVD interrupt.

swhite
Associate III
Posted on June 23, 2009 at 21:33

Using/testing the PVD interrupt.

2 REPLIES 2
swhite
Associate III
Posted on May 17, 2011 at 13:15

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);

}

swhite
Associate III
Posted on May 17, 2011 at 13:15

Solved it 🙂 The problem was another

EXTI_DeInit();

line in another part of the program. That was undoing the initialization for EXTI_Line16 :-Y