这几天在调试
STM32f030f4p6这颗
芯片进入stop模式,然后被唤醒,我是用PA1做的,PA1配置成外部下降沿中断,来做开关键:板子开机 -> 按下PA1 -> 芯片进入stop模式 -> 按下PA1 -> 外部中断将芯片唤醒 。。。
程序处理如下:
void EX
ti0_1_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line1)!= RESET )
{
if(mcu_state == MCU_IS_RUNNING)
mcu_state = MCU_IS_STOP;
else if(mcu_state == MCU_IS_STOP)
mcu_state = MCU_IS_RUNNING;
b_mcu_exti_has_intterrupt = 1;
EXTI_ClearITPendingBit(EXTI_Line1);
}
}
然后在main里面:
void MCU_State_Change(void)
{
if(b_mcu_exti_has_intterrupt)
{
b_mcu_exti_has_intterrupt = 0;
if(mcu_state == MCU_IS_RUNNING)
{
}
else if(mcu_state == MCU_IS_STOP)
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE);
NVIC_SystemLPConfig(NVIC_LP_SLEEPDEEP,ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE);
PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI);
}
}
}
现在发现两个问题:
1.感觉按键不是很灵敏,有时要按几下才能进入休眠,有时休眠要按几下才能唤醒,外部中断我
仿真过,每次按下按键都能进到中断里面。
2.芯片进入stop模式之后被唤醒,时钟明显感觉变慢了,我在数码管上做了TIM16计数,我后来在:
if(mcu_state == MCU_IS_RUNNING)
{
TIM16_For_Tick_Start(); /*开定时器*/
}
这里又将TIM16初始化了一次,感觉还是慢了,不知道是什么问题
If Flash memory programming is ongoing, the Stop mode entry is delayed until the memory
access is finished.
If an access to the APB domain is ongoing, The Stop mode entry is delayed until the APB
access is finished.
一周热门 更多>