完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
CAN0的能进去接收正常,CAN1是按葫芦画的,怎么不行呢,请指教
void FCAN1_Init(void) { uint32_t i32=0x00; /* Enable CAN module clock */ CLK_EnableModuleClock(CAN1_MODULE); /* Set PD multi-function pins for CANTX1, CANRX1 */ SYS->GPD_MFP &= ~(SYS_GPD_MFP_PD14_Msk | SYS_GPD_MFP_PD15_Msk); SYS->GPD_MFP |= SYS_GPD_MFP_PD15_CAN1_TXD | SYS_GPD_MFP_PD14_CAN1_RXD; SYS->ALT_MFP &= ~(SYS_ALT_MFP2_PD14_Msk | SYS_ALT_MFP2_PD15_Msk); SYS->ALT_MFP |= SYS_ALT_MFP2_PD15_CAN1_TXD | SYS_ALT_MFP2_PD14_CAN1_RXD; SelectCANSpeed(tCAN1); tCAN1->IF[0].MASK1 = 0x00UL; tCAN1->IF[0].MASK2 = 0x00UL; tCAN1->IF[0].MCON = 0x00; srecemsg_totalnumbers = 0x00; for(i32=0x00;i32IF[1].MASK1,tCAN0->IF[1].MASK2,tCAN0->IF[1].MCON); /* INT Mode */ CAN_EnableInt(tCAN1, CAN_CON_IE_Msk|CAN_CON_SIE_Msk|CAN_CON_EIE_Msk); /* Enable CAN interrupt and corresponding NVIC of CAN */ NVIC_SetPriority(CAN1_IRQn, (1 << __NVIC_PRIO_BITS) - 2); /* Install CAN call back functions */ NVIC_EnableIRQ(CAN1_IRQn); } 我也在用230 现在遇到can1中断既不去,楼主这个问题你解决了么? |
|
相关推荐
1个回答
|
|
D_MFP_PD14_CAN1_RXD;
/* Reset CAN1 */ SYS_ResetModule(CAN1_RST); /* Set CAN1 baud rate */ CAN_Open(CAN1, CAN_BAUDRATE_500K, CAN_NORMAL_MODE); /* Enable CAN1 receive interrupt */ CAN_EnableInt(CAN1, CAN_CON_IE_Msk | CAN_CON_SIE_Msk); NVIC_EnableIRQ(CAN1_IRQn); /* Set CAN1 message mask */ CAN_SetRxMsg(CAN1, CAN_STD_ID_MASK, CAN_STD_ID_MASK, CAN_MSG_ENHANCED);} One possible solution is to check if the CAN1 interrupt is enabled in the NVIC. If it is not enabled, use the "NVIC_EnableIRQ(CAN1_IRQn);" command to enable it. Another solution is to check the CAN1 configuration and ensure that it is correctly set up for the desired use case, including setting the CAN1 message mask and ensuring that the PD14 and PD15 pins are configured correctly. Finally, it may be helpful to use a debugger or oscilloscope to verify the CAN1 signals and diagnose any potential hardware issues. |
|
|
|
只有小组成员才能发言,加入小组>>
800 浏览 0 评论
1156 浏览 1 评论
2531 浏览 5 评论
2863 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2714 浏览 6 评论
keil5中manage run-time environment怎么是灰色,不可以操作吗?
1089浏览 3评论
195浏览 2评论
461浏览 2评论
374浏览 2评论
M0518 PWM的电压输出只有2V左右,没有3.3V是怎么回事?
456浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 17:36 , Processed in 1.368344 second(s), Total 80, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号