AnsweredAssumed Answered

STM32F4Discovery RTC WakeUp Interrupt

Question asked by william.ben on Aug 17, 2014
Latest reply on Aug 18, 2014 by william.ben
Hello,I'm currently quiet frustratedI'm trying to set up with the RTC wakeUp register an interrupt of 128Hz. For the RTC the LSI is used (I know not very precisely but for current testing propuse its enough)here is my code I use:
void init()
    RTC_InitTypeDef RTC_InitStructure;
    EXTI_InitTypeDef  EXTI_InitStructure;
    NVIC_InitTypeDef  NVIC_InitStructure;
    /* Enable the PWR clock */
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
    /* Allow access to RTC */
    /* Enable the LSI OSC */
    /* Wait till LSI is ready */
    while(RCC_GetFlagStatus(RCC_FLAG_LSIRDY) == RESET)
    /* Select the RTC Clock Source */
    /* Configure the RTC data register and RTC prescaler */
    RTC_InitStructure.RTC_AsynchPrediv = 0x7F; // prescaler set to optain a 1 Hz signal of the 32kHz LSI
    RTC_InitStructure.RTC_SynchPrediv = 0xFF; // prescaler set to optain a 1 Hz signal of the 32kHz LSI
    RTC_InitStructure.RTC_HourFormat = RTC_HourFormat_24;
    /* Check on RTC init */
    if (RTC_Init(&RTC_InitStructure) == ERROR)
    /* Enable the RTC Clock */
    /* Wait for RTC APB registers synchronisation */
    /* Enable the Wakeup Interrupt */
    /* Connect EXTI_Line22 to the RTC Wakeup event */
    EXTI_InitStructure.EXTI_Line = EXTI_Line22;
    EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
    EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
    EXTI_InitStructure.EXTI_LineCmd = ENABLE;
    /* Enable the RTC Wakeup Interrupt */
    NVIC_InitStructure.NVIC_IRQChannel = RTC_WKUP_IRQn;
    NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
    NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
    /* Enable Wakeup Counter */
void RTC_WKUP_IRQHandler(void)
        // Interrupt Flags loeschen
I'm using GCC 4.7.3 with the code above the RTC_WKUP_IRQHandler is never calledwhen I put a "RTC_ClearITPendingBit(RTC_IT_WUT);" at the end of
init() my RTC_WKUP_IRQHandler is still never called but the whole programms hangs in "def_irq_handler    RTC_WKUP_IRQHandler" defined in the file startup_stm32f4xx.S I think because the RTC_IT_WUT flag is never cleared