|
各位高手,请教个问题,我想在STM8L151主电掉电的情况下使起进入Active-halt模式(只启用RTC)使用电池供电,主电恢复后由上电复位电路复位进入正常工作 下面是部分程序,因第一次用该芯片,不知道怎么进入Active-halt模式,下面是部分程序,实测电流超过3mA,请高手们帮我看看那里出问题了 void power_init(void)//电源管理 { PWR_DeInit(); PWR_PVDLevelConfig(PWR_PVDLevel_3V05);//阀值电压3.05 PWR_PVDCmd(ENABLE); PWR_FastWakeUpCmd(ENABLE); PWR_PVDITConfig(ENABLE); } void lowpower_config(void) { GPIO_DeInit(GPIOA); GPIO_DeInit(GPIOB); GPIO_DeInit(GPIOC); GPIO_DeInit(GPIOD); GPIO_DeInit(GPIOE); GPIO_DeInit(GPIOF); ADC_DeInit(ADC1); TIM2_DeInit(); TIM1_DeInit(); USART_DeInit(USART1); CLK_PeripheralClockConfig(CLK_Peripheral_ADC1, DISABLE); CLK_PeripheralClockConfig(CLK_Peripheral_DMA1, DISABLE); GPIO_Init(GPIOA, GPIO_Pin_4, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOA, GPIO_Pin_5, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOA, GPIO_Pin_6, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD, GPIO_Pin_1, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD, GPIO_Pin_3, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_1, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_7, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOF, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_3, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_4, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_5, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE, GPIO_Pin_6, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOC, GPIO_Pin_1, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOC, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD, GPIO_Pin_7, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_5, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB, GPIO_Pin_7, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD,GPIO_Pin_5,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD,GPIO_Pin_4,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOB,GPIO_Pin_6,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOA,GPIO_Pin_7,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_0,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_1,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_2,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_3,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_4,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_5,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD,GPIO_Pin_0,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOD,GPIO_Pin_6,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOE,GPIO_Pin_7,GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOC, GPIO_Pin_2, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOC, GPIO_Pin_3, GPIO_Mode_In_PU_No_IT); GPIO_Init(GPIOC, GPIO_Pin_4, GPIO_Mode_In_PU_No_IT); CLK_PeripheralClockConfig(CLK_Peripheral_USART1, DISABLE); CLK_PeripheralClockConfig(CLK_Peripheral_TIM2, DISABLE); CLK_PeripheralClockConfig(CLK_Peripheral_TIM1, DISABLE); PWR_UltraLowPowerCmd(ENABLE); CLK_SYSCLKDivConfig(CLK_SYSCLKDiv_1); CLK_SYSCLKSourceConfig(CLK_SYSCLKSource_LSE); CLK_SYSCLKSourceSwitchCmd(ENABLE); while (CLK_GetSYSCLKSource() != CLK_SYSCLKSource_LSE){}; CLK_HSEConfig(CLK_HSE_OFF); CLK_HaltConfig(CLK_Halt_FastWakeup,ENABLE);//快速唤醒 halt(); } INTERRUPT_HANDLER(EXTIE_F_PVD_IRQHandler, 5) { lowpower_config(); PWR_PVDITConfig(DISABLE); } } |
STM8S103飞线外接芯片,I2C不能得到slaveAddress应答,通讯失败。
测试标签123
IAR FOR ARM和IAR FOR STM8无法共存,
STM8L052,液晶内部电源怎么用?
STM8S105C6T6 UART2串口,能接收数据,不能发送数据
STM8S105K4 串口2 无奇偶校验,也能接收 偶校验的 数据
在STM8S的IAP使用中断和APP使用中断问题
STM8L151 SMBUS设计
STM8S103F复位异常
STM8L的LCD调试时不亮
微信公众号
手机版
临时写的,主要目的是试下低功耗的电流变化,为了方便调试,搞了这么多!结果貌似之前的片子有问题,一直没法调出来低功耗,换了块好像是行了,只是还没时间具体试