在做休眠时,采用的是RTC Alarm方式唤醒MCU,但是系统又同时使用了Systick作为时钟基准计数器。 如何避免休眠时被Systick唤醒,但是同时可以让Systick正常运转计数。 求帮忙,谢谢? void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; /* 2 bits for Preemption Priority and 2 bits for Sub Priority */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); NVIC_InitStructure.NVIC_IRQChannel = RTCAlarm_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } //系统滴答计数器 void SysTick_Configuration(void) { /* Setup SysTick Timer for 1 msec interrupts */ if (SysTick_Config(SystemFrequency / 1000)) { /* Capture error */ while (1); } /* Set SysTick Priority to 3 */ NVIC_SetPriority(SysTick_IRQn, 0x0C); } main函数主循环如下 while (1) { /* Insert 1.5 second delay */ Delay(1500); /* Wait till RTC Second event occurs */ RTC_ClearFlag(RTC_FLAG_SEC); while(RTC_GetFlagStatus(RTC_FLAG_SEC) == RESET); /* Alarm in 3 second */ RTC_SetAlarm(RTC_GetCounter()+ 3); /* Wait until last write operation on RTC registers has finished */ RTC_WaitForLastTask(); /* Turn off led connected to GPIO_LED Pin9 */ LED_OFF(GPIO_Pin_10); /* Request to enter STOP mode with regulator in low power mode*/ PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI); /* At this stage the system has resumed from STOP mode -------------------*/ /* Configures system clock after wake-up from STOP: enable HSE, PLL and select PLL as system clock source (HSE and PLL are disabled in STOP mode) */ SYSCLKConfig_STOP(); } //延时函数 void Delay(__IO uint32_t nTime) { TimingDelay = nTime; while(TimingDelay != 0){}; } //中断响应 void SysTick_Handler(void) { TimingDelay--; } |
RE:关于STM32的休眠与Systick如何共用的问题,跪求大侠帮忙??
RE:关于STM32的休眠与Systick如何共用的问题,跪求大侠帮忙??
RE:关于STM32的休眠与Systick如何共用的问题,跪求大侠帮忙??
不过这方法属于治标不治本了