void EXTI0_IRQHandler(void) { RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR | RCC_APB1Periph_BKP, ENABLE); if(EXTI_GetITStatus(EXTI_Line0) != RESET) //检查指定的EXTI0线路触发请求发生与否 { EXTI_ClearITPendingBit(EXTI_Line0); //清除EXTI0线路挂起位 EXTI_ClearFlag(EXTI_Line0); //清楚EXTI0线路挂起标志位 if(STOP_MODEL()) { PWR_EnterSTOPMode(PWR_Regulator_LowPower,PWR_STOPEntry_WFI); } } } void EXTI1_IRQHandler(void) { ErrorStatus HSEStartUpStatus; RCC_HSEConfig(RCC_HSE_ON); /* Wait till HSE is ready */ HSEStartUpStatus = RCC_WaitForHSEStartUp(); if(HSEStartUpStatus == SUCCESS) { /* Select HSE as system clock source */ RCC_SYSCLKConfig(RCC_SYSCLKSource_HSE); } if(EXTI_GetITStatus(EXTI_Line1) != RESET) //检查指定的EXTI1线路触发请求发生与否 { EXTI_ClearITPendingBit(EXTI_Line1); //清除EXTI1线路挂起位 EXTI_ClearFlag(EXTI_Line1); //清楚EXTI1线路挂起标志位 } } 通过中断0使CPU进入STOP模式,想通过中断1来唤醒,但是无法唤醒 中断配置如下 GPIO_InitTypeDef GPIO_InitStructure; EXTI_InitTypeDef EXTI_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB|RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO,ENABLE); //init GPIOB.0 下拉输入 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; GPIO_Init(GPIOB, &GPIO_InitStructure); //GPIOB.0 GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource0); EXTI_InitStructure.EXTI_Line=EXTI_Line0; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x02; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //init GPIOA.1 下拉输入 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; GPIO_Init(GPIOA, &GPIO_InitStructure); //GPIOA.1 GPIO_EXTILineConfig(GPIO_PortSourceGPIOA,GPIO_PinSource1); EXTI_InitStructure.EXTI_Line=EXTI_Line1; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x03; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x02; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); 新手没有积分,还希望大侠们指点。 |
【MCU实战经验】基于STM32F103C8T6的hart总线调试器设计
基于STM32F103RCT6的无源蜂鸣器音乐播放(生日快乐歌)
STM32F103c8t6有没有DAC 功能?
STM32F103x中文数据手册
新手求教,为何在我电脑上找不到STM32F1Xx.h文件
金龙107例程汇总(STM32F107)
万利STM32F107VC 原理图
STM32F103 ADC多通道检测必须要DMA吗?
【官方例程】STM32F107以太网官方例程
STM32F105 USB接收数据不断进入中断,出现“死机”现象
RE:求教STM32F103进入STOP模式后用外部中断唤醒的问题
回复:求教STM32F103进入STOP模式后用外部中断唤醒的问题
EXTI_ClearITPendingBit(EXTI_Line1); //清除EXTI1线路挂起位 EXTI_ClearFlag(EXTI_Line1); //清楚EXTI1线路挂起标志位
请在这两句的前面加上对Line0的同样处理,这样就可以防止IO同时触发的情况下,反复进入STOP的问题。