我是用CAN1中断进行接收信息,在ch32v30x_it.c中添加了中断声明
void CAN1_RX1_IRQHandler(void) __attribute__((interrupt("WCH-Interrupt-fast"))); void CAN1_RX1_IRQHandler(void) { CAN_IRQHandler(CAN1); }
也对中断函数进行了中断优先级配置,但是依然接收不到CAN数据,并且调试的时候,发现没有执行CAN_IRQHandler(CAN1);函数
NVIC_InitTypeDef NVIC_InitStructure={0}; NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); NVIC_InitStructure.NVIC_IRQChannel = CAN1_RX1_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 2; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); CAN_ITConfig(CAN1, CAN_IT_FMP0 | CAN_IT_FMP1, ENABLE); //开启CAN1的接收中断
热门产品 :
CH339: 7端口多功能USB HUB控制器芯片