Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

XMC™ Forum Discussions

User8570
Level 3
Level 3
I have 3 boards on the same CAN bus, which start/power up at the same time. Each board TX a heart beat message every 100ms. It looks like some time one board stops transmitting the CAN message, and then other has the same symptom. Always one board is not TX a CAN message.

I am using the CAN001 App to do the CAN TX process. Wondering if maybe I am not handling a specific error during TX? Each board also has a different address/mask setup.
0 Likes
3 Replies
Travis
Employee
Employee
First like received
Hi jptalledo,

is your above mentioned issues related to the one stated below?

http://www.infineonforums.com/threads/2158-CAN001-identifier-and-data-length-issue
0 Likes
User8570
Level 3
Level 3
Travis

My issue is when transmitting two consecutive messages using the same LMObject, sometimes I don't see the first message on my CANalyzer tool. Only the second. Sometimes I see both. Looks like the problem is related to using the same LM0bject to transmit two CAN messages?

This is the code I was using:
TempMsgHandle1.Identifier = id;
TempMsgHandle1.DataLength = 8;
TempMsgHandle1.IDExten =1; // 0 or 1
TempMsgHandle1.MsgObjEN = CAN001_ENABLE; // must be enabled
TempMsgHandle1.MsgObjType = (CAN_MsgType)1; // Tx=1 or Rx=0
TempMsgHandle1.data[0] = 0x1A;
TempMsgHandle1.data[1] = 0x2B;
TempMsgHandle1.data[2] = 0x03C;
TempMsgHandle1.data[3] = 0x4D;
TempMsgHandle1.data[4] = vcb_control;
TempMsgHandle1.data[5] = error_pwm;
TempMsgHandle1.data[6] = error_adc;
TempMsgHandle1.data[7] = error_dac;

CAN001_ConfigMsgObj(&CAN001_Handle1, &TempMsgHandle1, 2);
CAN001_UpdateMODataRegisters(&CAN001_Handle1, 2, TempMsgHandle1.DataLength, TempMsgHandle1.data);
CAN001_SendDataFrame(&CAN001_Handle1,2); //



timer = 0;
endpoint = 25;
address = MY_ADDRESS;
direction = 0;
priority = 0;
id = (timer) | ((endpoint & 0xff) << 10) | ((address & 0x1ff) << 18) | ((direction & 0x0001)<< 28) | ((priority & 0x0001) << 27);

TempMsgHandle1.Identifier = id;
TempMsgHandle1.DataLength = 8;
TempMsgHandle1.IDExten =1; // 0 or 1
TempMsgHandle1.MsgObjEN = CAN001_ENABLE; // must be enabled
TempMsgHandle1.MsgObjType = (CAN_MsgType)1; // Tx=1 or Rx=0
TempMsgHandle1.data[0] = can_throttle_position;
TempMsgHandle1.data[1] = ThrottlePercent;
TempMsgHandle1.data[2] = ((a2dPedal_lo & 0xFF00) >> 8);
TempMsgHandle1.data[3] = (a2dPedal_lo & 0x00FF);
TempMsgHandle1.data[4] = ((a2dECU_lo & 0xFF00) >> 8);
TempMsgHandle1.data[5] = (a2dECU_lo & 0x00FF);
TempMsgHandle1.data[6] = 0;
TempMsgHandle1.data[7] = 0;

CAN001_ConfigMsgObj(&CAN001_Handle1, &TempMsgHandle1, 2);
CAN001_UpdateMODataRegisters(&CAN001_Handle1, 2, TempMsgHandle1.DataLength, TempMsgHandle1.data);
CAN001_SendDataFrame(&CAN001_Handle1,2); //


I will try to implement a second TX LMObject and use it to transmit the 2nd CAN message.Do you think this will be the solution? or I need to add extra logic to transmit 2 CAN messages almost next to each other?
0 Likes
Travis
Employee
Employee
First like received
Did you ensure that the first message is transmitted before putting the next one in? Maybe the API take care of this which I am not so sure. To troubleshoot this you can put a delay in betwee these 2 messages.
0 Likes