STM32开启里SPI输出寄存器空中断,以及TIM4的输入捕获、输出匹配中断。
SPI和TIME4的中断优先级都设置成抢占优先级为0,响应优先级为2,能正常进入两个中断。都设置成抢占优先级为0,响应优先级为3也能正常工作。
其它形式的设置都不能正常工作。感觉很奇怪!!
有人能帮忙解答一下产生这个问题的原因吗?
优先级设置如下:
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel=SPI1_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel=TIM4_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =0 ;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 2;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); |