|
本帖最后由 sunplus 于 2018-12-27 15:46 编辑
STM32F030 Stop模式下RTC运行,另外配置了一个IO做为外部唤醒。
这样的情况功耗最低可以到多少?
我这边实测25uA,这是正常的吗?
正常工作使用到了GPIO、TIM、ADC、USART、RTC 这些外设
下面是进入stop模式前的处理,代码如下:
- void EnterStopMode()
- {
- NVIC_InitTypeDef NVIC_InitStructure;
- GPIO_InitTypeDef GPIO_InitStructure;
- EXTI_InitTypeDef EXTI_InitStructure;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
- GPIO_Init(GPIOA,&GPIO_InitStructure);
- GPIO_Init(GPIOB,&GPIO_InitStructure);
- GPIO_Init(GPIOC,&GPIO_InitStructure);
- //配置 KEY4_GPIO_PIN 中断唤醒退出 stop模式
- GPIO_InitStructure.GPIO_Mode =GPIO_Mode_IN;
- GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; //上拉
- GPIO_InitStructure.GPIO_Pin =KEY4_GPIO_PIN;
- GPIO_Init(KEY_GPIO_PORT,&GPIO_InitStructure);
- /* Disable GPIOs clock */
- RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOA |RCC_AHBPeriph_GPIOB | RCC_AHBPeriph_GPIOC |RCC_AHBPeriph_DMA1,
- DISABLE);
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2|RCC_APB1Periph_DAC|RCC_APB1Periph_TIM3,
- DISABLE);
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,
- DISABLE);
-
- /* DISABLE the ADC peripheral */ //xudong add 20181227
- ADC_Cmd(ADC1, DISABLE);
- ADC_DeInit(ADC1);
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_ADC1,
- DISABLE);
-
- /* DISABLE the USART1 peripheral */
- USART_Cmd(USART1,DISABLE);
- USART_DeInit(USART1);
- /* DISABLE the USART2 peripheral */
- USART_Cmd(USART2,DISABLE);
- USART_DeInit(USART2);
-
- /* DISABLE the TIM3 peripheral */
- TIM_Cmd(TIM3,DISABLE);
- TIM_DeInit(TIM3);
-
-
- // RCC_LSEConfig(RCC_LSE_OFF);
- // RCC_DeInit();
-
- SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource7);
- EXTI_InitStructure.EXTI_Line = EXTI_Line7;
- EXTI_InitStructure.EXTI_LineCmd = ENABLE;
- EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
- EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //下降沿
- EXTI_Init(&EXTI_InitStructure);
- NVIC_InitStructure.NVIC_IRQChannel = EXTI4_15_IRQn ;
- NVIC_InitStructure.NVIC_IRQChannelPriority = 0;
- NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
- NVIC_Init(&NVIC_InitStructure);
-
- RTC_WriteBackupRegister(RTC_BKP_DR1,(gsetmin|((uint32_t)1<<31)));//最高位为标志位 其他位为数据 1代表 数据有效 将设定的 定时值保存到备份寄存器中
- PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI);
- }
复制代码 |
阿莫论坛20周年了!感谢大家的支持与爱护!!
一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。
|