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.

TMS570LS3137: CAN messages lost

Part Number: TMS570LS3137
Other Parts Discussed in Thread: HALCOGEN

Hello,

I am working with the TMS570LS31HDK. I am implementing a CAN gateway between DCAN1 and DCAN2. When I use one CAN to receive messajes and the other to transmit, all works perfectly. The problem is when i use both CAN channels to transmit and receive messages, 10% are lost.

thanks in advance

Best regards,

Dani Gomez

  • Hello,

    Whenever the CAN bus is free, any unit may start to transmit a message. If 2 nodes start transmitting messages at the same time, the bus access conflict is resolved by bitwise arbitration using the ID. Do you use the same ID for 2 TX MSG boxes? 

  • Hello,

    No, I use different ID for the 2 TX MSG boxes. I use the function updateID provide by HALCoGen. In the configuration I configure the TX boxes with different IDs.

    Best regards

  • Hello.

    I have configured 2 mailboxes for input data and 2 mailboxes for output data in both CAN with fixed IDs. I send CAN frames every 10ms, and I can check that if I have a priority message in other mailbox (lower ID), it discard other messages. How is this possible if the busload is 10%?

    Thanks in advance,

    Best regards
  • This is just a just a guess.
    You might be doing your transmits in a way that invites collision. Can you create a single queue of messages for both ports, and confirm that the 'tx sent? interrupt' has fired before pushing the next frame?
  • Hello,

    Thanks for reply. How can i create a single queue for TX? Thanks
  • Instead of calling "canTransmit"; load the three parameters for canTransmit into arrays. Then loop to send the array values, but wait until the tx queue has no pending tx on either mailbox ID
  • Hello,

    I use this code to create the queue:

    	while (1) {
    	    for(i = 0; i < 50; i++) {
    	        if(txFrames[0][i] == 1)
    	        {
    	            while(canTransmit(canREG1, txFrames[1][i], &txFrames[2][i]) == 0);
    	            txFrames[0][i] = 0;
    	        }
    	        else if(txFrames[0][i] == 2)
    	        {
    	            while(canTransmit(canREG2, txFrames[1][i], &txFrames[2][i]) == 0);
    	            txFrames[0][i] = 0;
    	        }
    	    }
    	}

    I fill the txFrames data in the canMessageNotification function. The problem persists with this code. Any suggestions?

    Thanks in advance

  • Unless you modified the canTransmit function, each call inspects the status of just that specific canREG[1][2]. I suggest making sure both ports are clear.
    Also, the code you have would create a hardware stress test condition. Some lost frames might just be a limitation of what you have and what you are asking it to do.