void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure; /* 配置NVIC为优先级组2 */ NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//高2位为抢占优先级,低2位为响应优先级//0x500 //中断1设置优先级 /* 配置中断源:OC */ NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; //配置为EXTI0通道//6 /* 配置抢占优先级 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; /* 配置子优先级 */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; /* 使能中断通道 */ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //将上述配置参数传入中断初始化函数 //中断2设置优先级 /* 配置中断源:FAU */ NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn; //配置为EXTI1通道//7 /* 配置抢占优先级 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; /* 配置子优先级 */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; /* 使能中断通道 */ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //将上述配置参数传入中断初始化函数 //中断3设置优先级 /* 配置中断源:ADC DMA1 */ NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel1_IRQn; //配置为DMA1_Channel1_IRQn通道//11 /* 配置抢占优先级 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1; /* 配置子优先级 */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; /* 使能中断通道 */ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //将上述配置参数传入中断初始化函数 //中断4设置优先级 /* 配置中断源:SPI DMA1 */ NVIC_InitStructure.NVIC_IRQChannel = DMA1_Channel4_IRQn; //配置为DMA1_Channel4_IRQn通道//14 /* 配置抢占优先级 */ NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 3; /* 配置子优先级 */ NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1; /* 使能中断通道 */ NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); //将上述配置参数传入中断初始化函数 } 系统时钟,各IO口,SPI ,ADC,外部中断配置完成后进行NVIC_Configuration(),单步到第二个NVIC_Init(&NVIC_InitStructure)子程序时提示错误如下 |
评分
查看全部评分
这倒不一定。而且这不是现在的问题,问题应该在调试连接上。