Question
how to get PVD (programmable voltage detector) interrupt working ?
Posted on September 29, 2016 at 10:26
hello dear forum,
I want sense F103 Power Down to save a variable to the flash of the micro however it doesnot save - doesnot work accordingly ( I tried saving to flash in another program - it works ) I am using following codemain(){
---------------------------------
---------------------------------
NVIC_InitStructure.NVIC_IRQChannel = PVD_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 6;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);}
-------------------------------------
EXTI16init();
-------------------------------------
FLASH_Unlock();
EE_Init();
EEread_params();
----------------------------------
/* Configure the PVD Level to 2.9V */
PWR_PVDLevelConfig(PWR_PVDLevel_2V9);
/* Enable the PVD Output */
PWR_PVDCmd(ENABLE);
---------------------------------------------
}
---------------------------------------------
void
EXTI16init(
void
)
{
EXTI_InitTypeDef EXTI_InitStructure;
/* Configure EXTI Line16(PVD Output) to generate an interrupt on rising and
falling edges */
EXTI_ClearITPendingBit(EXTI_Line16);
EXTI_InitStructure.EXTI_Line = EXTI_Line16;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
----------------------------------
void
PVD_IRQHandler(
void
)
{
EXTI_ClearITPendingBit(EXTI_Line16);
EXTI_ClearFlag(EXTI_Line16);
EEsave_param();
while
(1){Delay(100);IWDG_ReloadCounter();}
}
what point am I missing ?
thank you
#stm32f103-pvd