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.

Compiler: CAN Communication for multiple nodes



Tool/software: TI C/C++ Compiler

I followed the instructions and successfully implemented in the CAN example code as mentioned in the Tiva C series for communication between 2 nodes . However
I am unable to find any sources about how to implement CAN for 3 or 4 nodes and how exactly the programming is done for handling them.
I am designing a data acquisition system for an Electric Vehicle and am unable to understand the programming in case there are multiple nodes .

In the example , only one node was sending data and the other was receiving . Can anyone direct me to any links or good resources for handling multi nodes in a CAN network?

Thanks in advance.

  • There really isn't anything different. The filtering is done by the MsgID. Lets say you have a five node network, one node for each of four wheels and a fifth node that receives the wheel speed from each of the four nodes. Assign a transmit mailbox with a unique MsgID for the wheel speed of each of the four wheel nodes, such as 0x100, 0x101, 0x102, and 0x103. Now at the receiving node you can take one of two approaches. (1) You can configure four receive mailboxes, one for each ID; or (2) you can configure a single receive mailbox and use the message ID mask such that this mailbox will receive any of the four transmitted messages. In the second case you know which wheel the information came from by reading the received message ID.
  • Thank you very much for replying. That does make sense. If you don't mind, I have some further queries.

    As per the example you mentioned
    Do i need to worry about the sequence of using CAN.send() functions from all the wheels or will their arbitration take care of that automatically.
    Or does one simply use the send function at some fixed interval from all 'wheel' nodes and let the CAN bus decide which one is sent first to the 5th node?
  • The nice thing about CAN is that the arbitration is done automatically. Each node will start to transmit only if the bus is currently unused. If two or more nodes start at the same time, the node with the lower message ID will win. Its message will be transmitted. The other nodes will wait until the bus is quiet, then try again automatically (no software intervention needed).