RT1061的CAN1驱动问题
使用RT-THREAD,在飞凌的SDK下修改:1.rtconfig.h 中增加 #define BSP_USING_CAN1
2.drvcan.c中增加
#ifdef BSP_USING_CAN1
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_08_FLEXCAN1_TX, 0U);
IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_09_FLEXCAN1_RX, 0U);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_08_FLEXCAN1_TX, 0x10B0u);
IOMUXC_SetPinConfig(IOMUXC_GPIO_AD_B1_09_FLEXCAN1_RX, 0x10B0u);
CLOCK_SetMux(kCLOCK_CanMux, 2);
CLOCK_SetDiv(kCLOCK_CanDiv, 3);
#endif
3.CANDEOM不变
编译下载后串口中输入 can_test can1 后CAN1口不断输出相同的数据帧,程序挂掉,调试串口显示
msh />psr: 0x60000034
r00: 0x401d0000
r01: 0x20000a30
r02: 0x20007e80
r03: 0x00000000
r04: 0x00000004
r05: 0x2000816c
r06: 0xdeadbeef
r07: 0xdeadbeef
r08: 0xdeadbeef
r09: 0xdeadbeef
r10: 0xdeadbeef
r11: 0xdeadbeef
r12: 0x00000000
lr: 0xfffffffd
pc: 0x20007e80
hard fault on handler
usage fault:
SCB_CFSR_UFSR:0x02 INVSTATE
去掉第2步使用can_test can2 can2口输出正常
页:
[1]