|
/////////////////////////////////////////////////////////// 在Standby模式休眠后,等RTC时间到后会复位一次。但进入STOP1模式时,RTC无法唤醒系统 //////////////////////////////////////////////////////////// void RCT_Init(void) { /* Enable RTC APB clock */ LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_RTC); LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR); LL_PWR_EnableBkUpAccess(); /* Enable LSE only if disabled.*/ if (LL_RCC_LSE_IsReady() == 0) { LL_RCC_ForceBackupDomainReset(); LL_RCC_ReleaseBackupDomainReset(); LL_RCC_LSE_Enable(); while (LL_RCC_LSE_IsReady() != 1) { } LL_RCC_SetRTCClockSource(LL_RCC_RTC_CLKSOURCE_LSE); } /* Peripheral clock enable */ LL_RCC_EnableRTC(); ///////////////////////////////////////////////// /* ######## ENABLE WUT #################################################*/ /* Disable RTC registers write protection */ LL_RTC_DisableWriteProtection(RTC); /* Set prescaler according to source clock */ LL_RTC_SetAsynchPrescaler(RTC, RTC_ASYNCH_PREDIV); LL_RTC_SetSynchPrescaler(RTC, RTC_SYNCH_PREDIV); /* Disable wake up timer to modify it */ LL_RTC_WAKEUP_Disable(RTC); /* Wait until it is allow to modify wake up reload value */ while (LL_RTC_IsActiveFlag_WUTW(RTC) != 1) { } /* Setting the Wakeup time to RTC_WUT_TIME s If LL_RTC_WAKEUPCLOCK_CKSPRE is selected, the frequency is 1Hz, this allows to get a wakeup time equal to RTC_WUT_TIME s if the counter is RTC_WUT_TIME */ LL_RTC_WAKEUP_SetAutoReload(RTC, 1); LL_RTC_WAKEUP_SetClock(RTC, LL_RTC_WAKEUPCLOCK_CKSPRE); /* Enable RTC registers write protection */ LL_RTC_EnableWriteProtection(RTC); /* Disable RTC registers write protection */ LL_RTC_DisableWriteProtection(RTC); //禁用RTC寄存器写入保护 /* Enable wake up counter and wake up interrupt */ /* Note: Periodic wakeup interrupt should be enabled to exit the device from low-power modes.*/ LL_RTC_EnableIT_WUT(RTC); //启用唤醒计数器和唤醒中断(没看见这个中断入口函数) LL_RTC_WAKEUP_Enable(RTC); //唤醒使能 /* Enable RTC registers write protection */ LL_RTC_EnableWriteProtection(RTC); /* Reset Internal Wake up flag */ LL_RTC_ClearFlag_WUT(RTC); /* ######## ENTER IN STANDBY MODE ######################################*/ ///////////////////////////////////////////////// } void EnterStandbyMode(void) { /* Set Standby mode */ LL_PWR_SetPowerMode(LL_PWR_MODE_STANDBY); /* Set SLEEPDEEP bit of Cortex System Control Register */ LL_LPM_EnableDeepSleep(); /* This option is used to ensure that store operations are completed */ /* Request Wait For Interrupt */ __WFI(); } void EnterSTOP1Mode(void) { /* Set STOP1 mode */ LL_PWR_SetPowerMode(LL_PWR_MODE_STOP1); /* Set SLEEPDEEP bit of Cortex System Control Register */ LL_LPM_EnableDeepSleep(); /* This option is used to ensure that store operations are completed */ /* Request Wait For Interrupt */ __WFI(); } |
STM32G030x6/x8被淋雨进水了但未通电,风险如何?怎么处理?
20GQCDR 请问这个是用在哪里的,各位大神帮忙看看,什么类型的,丝印是1242688
关于手动移植RTOS的问题,在基于HAL生成的工程上。xPortSysTickHandler()会影响外部晶振的时钟初始化,进入硬件故障处理函数,HSI没问题
使用单片机的USB PD功能时,初始化一直出错。
问询:哪里有STEVAL-L99615C的固件包下,主要是求L9961的源码,我用来抄I2C,大三小白刚刚接触MCU,求大佬指路
stm32g070rbt6 ADC1 多通道循环自动采样DMA传输到ram,采样时间要设置得很长采样值才能相对准确
ST-LINK Utility不能识别STM32G0的芯片,不能下载程序
STM32G030J6M6如何禁用NRST将其复用为ADC
年终77折活动,有哪些想兑换的?
stm32G030C8T6 官方例程库
微信公众号
手机版
If LL_RTC_WAKEUPCLOCK_CKSPRE is selected, the frequency is 1Hz,
this allows to get a wakeup time equal to RTC_WUT_TIME s
if the counter is RTC_WUT_TIME */
LL_RTC_WAKEUP_SetAutoReload(RTC, 1);
LL_RTC_WAKEUP_SetClock(RTC, LL_RTC_WAKEUPCLOCK_CKSPRE);
一秒唤醒一次
/* Setting the Wakeup time to RTC_WUT_TIME s
If LL_RTC_WAKEUPCLOCK_CKSPRE is selected, the frequency is 1Hz,
this allows to get a wakeup time equal to RTC_WUT_TIME s
if the counter is RTC_WUT_TIME */
LL_RTC_WAKEUP_SetAutoReload(RTC, 1);
LL_RTC_WAKEUP_SetClock(RTC, LL_RTC_WAKEUPCLOCK_CKSPRE);
一秒唤醒一次