2015-09-19 02:29 AM
Hello!
I have a simple program. It has software IRQ to enter Stop mode on return from ISR, and RTC IRQ to wake up and leave Stop mode. RTC IRQ toggles the red LED. On return from Stop mode (return from SW IRQ) the blue LED must be turned off, which never happen. What I see is: the red LED is toggled and the blue LED is always on. What is wrong ? Source code: void EXTI0_1_IRQHandler(void) { EXTI->PR = 1; SCB->SCR = 6; // deepsleep + sleeponexit } void RTC_IRQHandler(void) { EXTI->PR = EXTI_PR_PR20; RTC->ISR &= ~RTC_ISR_WUTF; LED_RED_TGL; }int main(void)
{ RCC->IOPENR = 3; // GPIO A,B clock RCC->APB1ENR |= (1 << 28); // PWR RCC->APB2ENR |= 1; // SYSCFGPWR->CR |= (1 << 8); // DBP
RCC->CSR |= (1 << 8); // LSE on while(!(RCC->CSR & (1 << 9))); // wait for LSE ready RCC->CSR |= (1 << 16) | (1 << 18); // RTC LSE src clk, RTC ena RTC->WPR = 0xCA; RTC->WPR = 0x53; while(!(RTC->ISR & 4)); // WUTWF RTC->WUTR = 0; // 1 second period EXTI->RTSR |= EXTI_RTSR_TR20; EXTI->IMR |= EXTI_IMR_IM20; NVIC_SetPriority (RTC_IRQn, 2); NVIC_EnableIRQ(RTC_IRQn); RTC->CR = RTC_CR_WUTE | RTC_CR_WUTIE | 4; // WUTE + WUTIE + ck_spre RTC->WPR = 0xFE; RTC->WPR = 0x64; EXTI->IMR |= EXTI_IMR_IM0; NVIC_SetPriority (EXTI0_1_IRQn, 0); NVIC_EnableIRQ(EXTI0_1_IRQn);LED_RED_ON;
LED_BLUE_ON; while(1) { EXTI->SWIER = EXTI_SWIER_SWIER0; // software IRQ LED_BLUE_OFF; // turn off blue LED } }2015-09-22 11:39 AM
UP
2015-09-22 12:26 PM
NORTH, EAST, and DOWN?
Ok, so consider why your initial post is not getting any responses. There appears to be code missing, it runs on a board you're not specifying, with LEDs you're not configuring and you're using a coding technique that's going to take 20-30 minutes of energy do anything productive with. Get that down to 2-3 minutes, and you might piques some interest.