不是的,原先还有一个100ms的定时器中断了,定时器的中断优先级小于串口的优先级,应该是定时器的中断影响了串口的中断,现在把定时器去掉,所有都在主程序运行了,发现按键也不会受影响了,串口接收数据也正常了这个先前的写的中断优先级的配置
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_SetPriorityGrouping(2);
NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = USART1_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
// NVIC_InitTypeDef NVIC_InitStructure;
// NVIC_SetPriority(USART1_IRQn,6);
// NVIC_EnableIRQ(USART1_IRQn);
//
// NVIC_SetPriority(USB_LP_CAN1_RX0_IRQn , 5);
// NVIC_EnableIRQ(USB_LP_CAN1_RX0_IRQn);
}
|