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.

TMS320F28377S: Setting more than one CANBUS ID in F28377S

Part Number: TMS320F28377S


Hi Everyone,

There are more than one PCB in my system and they have connected to each other by CANBUS, and everyone has a different ID ,

so my problem is that one of this PCB is master and read all datas from CANBUS and has to decide something 

can settings are:

CANEnable(CANA_BASE);

*(unsigned long *)ucTXMsgData = 0;
sTXCANMessage.ui32MsgID = 0x0338;
sTXCANMessage.ui32MsgIDMask = 0;
sTXCANMessage.ui32Flags = MSG_OBJ_TX_INT_ENABLE; 
sTXCANMessage.ui32MsgLen = sizeof(ucTXMsgData);
sTXCANMessage.pucMsgData = ucTXMsgData; 

*(unsigned long *)ucRXMsgData358 = 0;
sRXCANMessage358.ui32MsgID = 0x0358; 
sRXCANMessage358.ui32MsgIDMask = 0x0;
sRXCANMessage358.ui32Flags = MSG_OBJ_NO_FLAGS;
sRXCANMessage358.ui32MsgLen = sizeof(ucRXMsgData358);
sRXCANMessage358.pucMsgData = ucRXMsgData358;


*(unsigned long *)ucRXMsgData328 = 0;
sRXCANMessage328.ui32MsgID = 0x0328; 
sRXCANMessage328.ui32MsgIDMask = 0; 
sRXCANMessage328.ui32Flags = MSG_OBJ_NO_FLAGS;
sRXCANMessage328.ui32MsgLen = sizeof(ucRXMsgData328); 
sRXCANMessage328.pucMsgData = ucRXMsgData328; 

*(unsigned long *)ucRXMsgData329 = 0;
sRXCANMessage329.ui32MsgID = 0x0329; 
sRXCANMessage329.ui32MsgIDMask = 0;
sRXCANMessage329.ui32Flags = MSG_OBJ_NO_FLAGS;
sRXCANMessage329.ui32MsgLen = sizeof(ucRXMsgData329); 
sRXCANMessage329.pucMsgData = ucRXMsgData329; 

in my code i read every 10ms just one Received data and it is turning one ID to another...

first 10ms

CANMessageSet(CANA_BASE, 0x0358, &sRXCANMessage358, MSG_OBJ_TYPE_RX);
CANMessageGet(CANA_BASE, 0x0358, &sRXCANMessage358, true);

Mode =ucRXMsgData358[0];
Set_Current_1 =ucRXMsgData358[1]+((ucRXMsgData358[2]&0x00FF)<<8);
Set_Current_2 =ucRXMsgData358[3]+((ucRXMsgData358[4]&0x00FF)<<8);

another 10ms

CANMessageSet(CANA_BASE, 0x0328, &sRXCANMessage328, MSG_OBJ_TYPE_RX);
CANMessageGet(CANA_BASE, 0x0328, &sRXCANMessage328, true);

Temp_Heat_Sink_1 =ucRXMsgData328[0];
Temp_Transformer_1 =ucRXMsgData328[1];
Primary_Current_1 =ucRXMsgData328[2];

.

.

.

the question is that how i read all of them in same cycle?

  • Hi Eren,

    In the CAN protocol, the node that has the lowest node ID (sometimes referred to as message ID or CAN ID) will keep sending its message in the CAN bus until a node successfully receives it by sending an ACK (acknowledge) bit, then the node with the next lowest CAN ID which is may have been waiting to transmit will have its turn to send its message as soon as the previous node stops transmitting.  So at any given point, only one CAN message will be available in the CAN bus.  All this is done through arbitration, which is the basis of CAN communication.

    That said, you can only read one CAN message at a time.  What you might want to do is increase the baud rate and that will allow your application to read more messages in a shorter duration of time.

    Regards,

    Joseph