AnsweredAssumed Answered

WWDG EWI interrupt Issue

Question asked by john on Mar 28, 2016
Latest reply on Mar 29, 2016 by john

Hi all,

I have a serious issue with the EWI (Early wakeup interrupt) of the WWDG.
I'm using STM32F103 and I'm based on the example of the firmware libraries, I add the configuration of the EWI interrupt : the source code :
-----------------------------------------------------------------------------------------
/* WWDG configuration */
  /* Enable WWDG clock */
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_WWDG, ENABLE);
           
/* On Value line devices, WWDG clock counter = (PCLK1 (24MHz)/4096)/8 = 732 Hz (~1366 us)  */
/* On other devices, WWDG clock counter = (PCLK1(36MHz)/4096)/8 = 1099 Hz (~910 us)  */
  WWDG_SetPrescaler(WWDG_Prescaler_8);


  /* Set Window value to 80; WWDG counter should be refreshed only when the counter
    is below 80 (and greater than 64) otherwise a reset will be generated */
  WWDG_SetWindowValue(80);


  /* - On Value line devices,
    Enable WWDG and set counter value to 127, WWDG timeout = ~1366 us * 64 = 87.42 ms 
    In this case the refresh window is: ~1366us * (127-80) = 64.20 ms < refresh window < ~1366us * 64 = 87.42ms
     - On other devices
    Enable WWDG and set counter value to 127, WWDG timeout = ~910 us * 64 = 58.25 ms 
    In this case the refresh window is: ~910 us * (127-80) = 42.77 ms < refresh window < ~910 us * 64 = 58.25ms     
  */
              WWDG_EnableIT();


  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
           
  NVIC_InitStructure.NVIC_IRQChannel = WWDG_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
           
            WWDG_ClearFlag();
  WWDG_Enable(127);
---------------------------------------------------------------------------------------
The interrupt service routine code is : 

void WWDG_IRQHandler(void)
{
  if (WWDG_GetFlagStatus() != RESET)
  {
    WWDG_SetCounter(127);
    WWDG_ClearFlag();
  }
}
----------------------------------------------------------------------

The Problem is that the STM32F103 goes directly to EWI interrupt as soon as WWDG is enabled.

Can anyone help me please; it is urgent?

Thanks,
john

 

 

Outcomes