不知道是否是没配置好,使用STM32L151,IO从示波器是可以以33ns的速度翻转,也就是MCU以及IO的总线速度是32MHZ
按道理应该33nS*12=396nS再加上各种RP值,怎么也应该也小于1uS吧,但使用实际示波器观测,发现在外部上升沿后3uS以上的时间才进中断!
中断的周期是10uS,除了这个外部中断没有用到其他中断。
初始化设置如下
//BUSY_IO中断配置
void BUSY_I0_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure1;
NVIC_InitTypeDef NVIC_InitStructure1;
EXTI_InitTypeDef EXTI_InitStructure1;
/* Configure PA0 pin as input floating */
GPIO_InitStructure1.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure1.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure1.GPIO_Speed = GPIO_Speed_40MHz;
GPIO_InitStructure1.GPIO_Pin = GPIO_Pin_2;
GPIO_Init(GPIOA, &GPIO_InitStructure1);
/* Enable SYSCFG clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
/* Connect EXTI0 Line to PA0 pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource1);
/* Configure EXTI0 line */
EXTI_InitStructure1.EXTI_Line = EXTI_Line2;
EXTI_InitStructure1.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure1.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure1.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure1);
/* Enable and set EXTI0 Interrupt to the lowest priority */
NVIC_InitStructure1.NVIC_IRQChannel = EXTI2_IRQn;
NVIC_InitStructure1.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure1.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure1.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure1);
}
中断服务如下,也就是靠示波器观察IO跳变来判断什么时候进入中断
void EXTI2_IRQHandler(void)
{
GPIOA->BSRRH = GPIOA->BSRRL = (1<<8);
if(EXTI->PR & EXTI_Line2)
{
EXTI->PR = EXTI_Line2;//清中断
}
}
请教各位大大
|