1. 在CPU1中通讯没有问题,但换到CPU2中,就通讯不了。
2 .在CPU1中通讯时,按以下配置,可正常通讯:
GPIO_SetupPinMux(62, GPIO_MUX_CPU1, 6);
GPIO_SetupPinMux(63, GPIO_MUX_CPU1, 6);
GPIO_SetupPinOptions(62, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinOptions(63, GPIO_OUTPUT, GPIO_PUSHPULL);
CANInit(CANA_BASE);
CANClkSourceSelect(CANA_BASE, 0);
CANBitRateSet(CANA_BASE, 200000000, 500000);
CANEnable(CANA_BASE);
收/发数组定义:
*(unsigned int *)ucTXMsgData = 0;
sTXCANMessage.ui32MsgID = 0x500A01; // CAN message ID – use 1
sTXCANMessage.ui32MsgIDMask = 0; // no mask needed for TX
sTXCANMessage.ui32Flags = MSG_OBJ_TX_INT_ENABLE; // enable interrupt on TX
sTXCANMessage.ui32MsgLen = sizeof(ucTXMsgData); // size of message is 4
sTXCANMessage.pucMsgData = ucTXMsgData; // ptr to message content
*(unsigned int *)ucRXMsgData = 0;
sRXCANMessage.ui32MsgID = 0x500B01; // CAN message ID – use 1
sRXCANMessage.ui32MsgIDMask = 0; // no mask needed for TX
sRXCANMessage.ui32Flags = MSG_OBJ_NO_FLAGS;
sRXCANMessage.ui32MsgLen = sizeof(ucRXMsgData); // size of message is 4
sRXCANMessage.pucMsgData = ucRXMsgData; // ptr to message content
3. 移动到CPU2时,CAN通讯通讯不了,程序如下:
在CPU1中定义:
GPIO_SetupPinMux(62, GPIO_MUX_CPU2,6);
GPIO_SetupPinMux(63, GPIO_MUX_CPU2,6);
CANInit(CANA_BASE);
CANClkSourceSelect(CANA_BASE, 0);
CANBitRateSet(CANA_BASE, 200000000, 500000);
CANEnable(CANA_BASE);
在CPU2中定义收/发通讯数组,不能通讯;或者将
CANInit(CANA_BASE);
CANClkSourceSelect(CANA_BASE, 0);
CANBitRateSet(CANA_BASE, 200000000, 500000);
CANEnable(CANA_BASE);
放到CPU2中,也不能通讯。
请教大家在CPU2中分配CAN通讯,除了分配GPIO口设置,还需要那些配置?
Green Deng:
回复 user6328381:
感谢反馈,祝你后期调试顺利!