AnsweredAssumed Answered

problem with leaving from standby mode

Question asked by kwolek.jakub on Jul 26, 2013
Latest reply on Jul 26, 2013 by kwolek.jakub
Hi, i've got a problem with leaving from standby mode, both by RTC Alarm and WKUP pin. This is my code:

int main( void )
#ifdef DEBUG
        GPIOC->ODR |= (u16)0x0040;
        GPIOC->ODR &= (u16)~0x0040;
        while(1) {};
static void prvSetupHardware( void )
    RCC_APB2PeriphClockCmd(    RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB |RCC_APB2Periph_GPIOC
                            | RCC_APB2Periph_GPIOD | RCC_APB2Periph_GPIOE | RCC_APB2Periph_AFIO, ENABLE );
    NVIC_SetVectorTable( NVIC_VectTab_FLASH, 0x0 );
    NVIC_PriorityGroupConfig( NVIC_PriorityGroup_4 );   
void vEXTI_Configuration(void)
  EXTI_InitTypeDef EXTI_InitStructure;
  /* Configure EXTI Line17(RTC Alarm) to generate an interrupt on rising edge */
  EXTI_InitStructure.EXTI_Line = EXTI_Line17;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
void vNVIC_Configuration(void)
    NVIC_InitTypeDef NVIC_InitStructure;
    /* Configure one bit for preemption priority */
    /*Enable the RTC Alarm Interrupt*/
    NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQChannel;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
void vRTC_Configuration(void)
  RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE);
  /* Allow access to BKP Domain */
  PWR->CR |= 0x00000100;
  while (RCC_GetFlagStatus(RCC_FLAG_LSERDY) == RESET)  {}
  while( RTC_GetFlagStatus( RTC_FLAG_SEC ) == RESET )  {}
void RTCAlarm_IRQHandler(void)
      GPIOC->ODR ^= 0x00000080;
      if(PWR_GetFlagStatus(PWR_FLAG_WU) != RESET) PWR_ClearFlag(PWR_FLAG_WU);

I know that EXTI isn't necessary to wake MCU up from standby mode, but I tried the same code with Stop Mode and it works.
Another issue is strange operation with debugger (JLINK) connected to the eval board - with Stop mode I had to abort debug session, and reset MCU. In standby mode I tried with connected or disconnected debugger and it has never worked.
Could anyone help me?