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.

TMS320F28388D: Could not receive data about can example(can_ex3_extenal_transmit)

Part Number: TMS320F28388D
Other Parts Discussed in Thread: TMDSHSECDOCK

Tool/software:

Hi,

I am trying pcan viewer side(TJA1051 NPX  CAN receiver side) with F28388D EVK.

Here is my code.

========================
// Included Files
//
#include "driverlib.h"
#include "device.h"

//
// Defines
//
#define TXCOUNT 100
#define MSG_DATA_LENGTH 4
#define TX_MSG_OBJ_ID 1
//#define RX_MSG_OBJ_ID 1

//
// Globals
//
volatile unsigned long i;
volatile uint32_t txMsgCount = 0;
volatile uint32_t rxMsgCount = 0;
volatile uint32_t errorFlag = 0;
uint16_t txMsgData[4];
//uint16_t rxMsgData[4];

//
// Function Prototypes
//
//__interrupt void canbISR(void);

//
// Main
//
void main(void)
{
//
// Initialize device clock and peripherals
//
Device_init();

//
// Initialize GPIO and configure GPIO pins for CANTX/CANRX
// on module A and B
//
Device_initGPIO();
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANRXA);
GPIO_setPinConfig(DEVICE_GPIO_CFG_CANTXA);

//
// Initialize the CAN controllers
//
CAN_initModule(CANA_BASE);

//
// Set up the CAN bus bit rate to 500kHz for each module
// Refer to the Driver Library User Guide for information on how to set
// tighter timing control. Additionally, consult the device data sheet
// for more information about the CAN module clocking.
//
CAN_setBitRate(CANA_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);

//
// Initialize the transmit message object used for sending CAN messages.
// Message Object Parameters:
// CAN Module: A
// Message Object ID Number: 1
// Message Identifier: 0x15555555
// Message Frame: Extended
// Message Type: Transmit
// Message ID Mask: 0x0
// Message Object Flags: None
// Message Data Length: 4 Bytes (Note that DLC field is a "don't care"
// for a Receive mailbox
//
#if 0
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x15555555,
CAN_MSG_FRAME_EXT, CAN_MSG_OBJ_TYPE_TX, 0,
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);

#endif

//change ext -> std
CAN_setupMessageObject(CANA_BASE, TX_MSG_OBJ_ID, 0x15555555,
CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_TX, 0,
CAN_MSG_OBJ_NO_FLAGS, MSG_DATA_LENGTH);

//
// Initialize the transmit message object data buffer to be sent
//
txMsgData[0] = 0x11;
txMsgData[1] = 0x22;
txMsgData[2] = 0x33;
txMsgData[3] = 0x44;

//
// Start CAN module A and B operations
//
CAN_startModule(CANA_BASE);

while(1)
{
CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH, txMsgData);
}

#if 0
for(i = 0; i < TXCOUNT; i++)
{
//
// Verify that the number of transmitted messages equal the number of
// messages received before sending a new message
//
if(txMsgCount == rxMsgCount)
{
CAN_sendMessage(CANA_BASE, TX_MSG_OBJ_ID, MSG_DATA_LENGTH, txMsgData);
txMsgCount++;
}
//
// Delay 0.25 second before continuing
//
DEVICE_DELAY_US(250000);

//
// Increment the value in the transmitted message data.
//
txMsgData[0] += 0x01;
txMsgData[1] += 0x01;
txMsgData[2] += 0x01;
txMsgData[3] += 0x01;

//
// Reset data if exceeds a byte
//
if(txMsgData[0] > 0xFF)
{
txMsgData[0] = 0;
}
if(txMsgData[1] > 0xFF)
{
txMsgData[1] = 0;
}
if(txMsgData[2] > 0xFF)
{
txMsgData[2] = 0;
}
if(txMsgData[3] > 0xFF)
{
txMsgData[3] = 0;
}

}

#endif
//
// Stop application
//
asm(" ESTOP0");
}
//
// End of File
//

I only edit part is CAN_MSG_FRAME_EXT => CAN_MSG_FRAME_STD.

and when i check osilloscope, there is signal something. but trash data.

and pcan viewer saw any message.

could you guide anything?