AnsweredAssumed Answered

how to get PVD (programmable voltage detector) interrupt working ?

Question asked by karakaya.mehmet on Sep 29, 2016
Latest reply on Oct 17, 2016 by FTITI.Walid
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 code

main(){
---------------------------------
---------------------------------
  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

Outcomes