我是用CAN1中斷進行接收信息,在ch32v30x_it.c中添加了中斷聲明
void?CAN1_RX1_IRQHandler(void)?__attribute__((interrupt("WCH-Interrupt-fast"))); void?CAN1_RX1_IRQHandler(void) { ????CAN_IRQHandler(CAN1); }
也對中斷函數(shù)進行了中斷優(yōu)先級配置,但是依然接收不到CAN數(shù)據(jù),并且調(diào)試的時候,發(fā)現(xiàn)沒有執(zhí)行CAN_IRQHandler(CAN1);函數(shù)
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的接收中斷
熱門產(chǎn)品 :
CH641: PD及無線充電專用MCU