This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F28377D CAN发送数据CANMonitor接收不到

Other Parts Discussed in Thread: CONTROLSUITE, SN65HVD230

#include "F28x_Project.h" // Device Headerfile and Examples Include File
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_types.h"
#include "inc/hw_memmap.h"
#include "inc/hw_can.h"
#include "driverlib/can.h"

volatile unsigned long g_ulMsgCount = 0;

volatile unsigned long g_bErrFlag = 0;

int
main(void)
{
tCANMsgObject sTXCANMessage;
tCANMsgObject sRXCANMessage;
unsigned char ucTXMsgData[4];
unsigned char ucRXMsgData[4];
InitSysCtrl();
InitGpio();
//GPIO30 - CANRXA
GPIO_SetupPinMux(5, GPIO_MUX_CPU1, 6);
//GPIO31 - CANTXA
GPIO_SetupPinMux(4, GPIO_MUX_CPU1, 6);
GPIO_SetupPinOptions(5, GPIO_INPUT, GPIO_ASYNC);
GPIO_SetupPinOptions(4, GPIO_OUTPUT, GPIO_PUSHPULL);

CANInit(CANA_BASE);

CANClkSourceSelect(CANA_BASE, 0);

CANBitRateSet(CANA_BASE, 200000000, 500000);// 500 kHz.

DINT;

InitPieCtrl();

IER = 0x0000;
IFR = 0x0000;

InitPieVectTable();

// HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_TEST;
// HWREG(CANA_BASE + CAN_O_TEST) = CAN_TEST_EXL;


// Enable the CAN for operation.
CANEnable(CANA_BASE);

*(unsigned long *)ucTXMsgData = 0;
sTXCANMessage.ui32MsgID =1 ; // 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

// Initialize the message object that will be used for recieving CAN
// messages.
*(unsigned long *)ucRXMsgData = 0;
sRXCANMessage.ui32MsgID = 1; // 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

// Setup the message object being used to receive messages
CANMessageSet(CANA_BASE, 2, &sRXCANMessage, MSG_OBJ_TYPE_RX);

for(;;)
{

CANMessageSet(CANA_BASE, 1, &sTXCANMessage, MSG_OBJ_TYPE_TX);

DELAY_US(1000*1000);

// Get the receive message
CANMessageGet(CANA_BASE, 2, &sRXCANMessage, true);
.
(*(unsigned long *)ucTXMsgData)++;

}

}

这是TI controlSUITE里的代码  将LOOPBACK的两行代码屏蔽

// HWREG(CANA_BASE + CAN_O_CTL) |= CAN_CTL_TEST;
// HWREG(CANA_BASE + CAN_O_TEST) = CAN_TEST_EXL;

CAN控制芯片为sn65hvd230,通过示波器测CAN芯片的TX、RX、CANH和CANL管脚都有波形,但是通过CANMonitor接收不到数据。

求各位大神指点明路呀!!