I'm setting up a new project on an STM32F152, and and having a problem with the wakeup timer of the RTC. It seems to be running, setting the interrupt flag, and the interrupt is enabled, but not jumping to the handler. I'm using IAR's toolkit. The code looks like this:
SCB->VTOR = 0x08000000; RCC->CR |= (uint32_t)0x00000100;
/*!< Reset SW[1:0], HPRE[3:0], PPRE1[2:0], PPRE2[2:0], MCOSEL[2:0] and MCOPRE[2:0] bits */
RCC->CFGR &= (uint32_t)0x88FFC00C;
/*!< Reset HSION, HSEON, CSSON and PLLON bits */ RCC->CR &= (uint32_t)0xEEFEFFFE;
/*!< Reset HSEBYP bit */ RCC->CR &= (uint32_t)0xFFFBFFFF;
/*!< Reset PLLSRC, PLLMUL[3:0] and PLLDIV[1:0] bits */ RCC->CFGR &= (uint32_t)0xFF02FFFF;
/*!< Disable all interrupts */ RCC->CIR = 0x00000000;
/*!< Configure the System clock frequency, HCLK, PCLK2 and PCLK1 prescalers */
/*!< Configure the Flash Latency cycles and enable prefetch buffer */ // SetSysClock();
RCC->APB1ENR |= (1 CR |= (1 CSR |= (1 CSR & (1 CSR |= (1 WRP = 0xCA; RTC->WRP = 0x53; RTC->CR &= ~RTC_CR_WUTE; // enable wake up timer while ((RTC->ISR & RTC_ISR_WUTWF) == 0) ; RTC->WUTR = 10000; // play with this when we know what we need; RTC->CR &= ~(RTC_CR_WUCKSEL_2); RTC->CR |= RTC_CR_WUCKSEL_0 | RTC_CR_WUCKSEL_1; // RTC/16 RTC->ISR &= ~RTC_ISR_WUTF; RTC->CR |= RTC_CR_WUTE; // enable wake up timer RCC->CSR |= RCC_CSR_RTCEN; // enable RTC as well. RTC->WRP = 0xFF ;
And when I look at the registers while running, I see that
RTC_CR = 0x00004403 which means, among other things WUTE and WUTIE are high. I can also watch RTC_ISR->WUTF transition from low to high.
I have a handler defined at RTC_WKUP_IRQHandler, but it's not happening.
Anything I'm forgetting?
Thanks.
--------------------------------------- Posted through