Controller Area Network (CAN, "can") is a serial broadcast communication protocol. It is a standard bus for communication between microcontrollers (uCs). On EVT, we use it for exactly that, communicating between uCs on boards around the bike. As a team, we also follow the CANopen standard, which is a higher-level protocol that expands on CAN. More information about CAN can be found on Wikipedia.
Each CAN bus can have many nodes on it, each of which is normally one of the team's circuit boards. Each uC interacts with the bus via a transceiver on its board. The uC is connected to the transceiver by two wires CAN TX and CAN RX. The wires work very differently from and should not be confused with UART's TX and RX. CAN TX is used by the uC to transmit messages, and CAN RX is used to receive messages. For outgoing messages, CAN transceiver converts CAN TX to CAN High and Low, which is sent to other transceivers around the bike. For incoming messages, the CAN transceiver, converts CAN High and Low to CAN RX, which is sent to the uC. CAN TX and RX need pull-up resistors, and CAN High and Low need terminating resistors. An example block diagram for CAN communication is shown below.
All CAN communication is handled with CAN frames. Each CAN frame consists of and ID, a data length, some data, and a Cyclic Redundancy Check (CRC). All nodes on the bus can send a frame whenever the bus is not busy, and all nodes can receive every message sent on the bus. Nodes can filter out frames with certain IDs to limit how many frames need to be processed.
The image below is a screenshot from Logic, the Saleae logic analyzer software. See Saleae Logic Analyzer for more information. The screenshot shows parts of two CAN frames, including data, a CRC, and an ID on CAN RX. There is also a brief toggle on the CAN TX wire, but this is likely an error.
If your CAN TX messages are not showing up, there is likely an electrical problem between the uC and the transceiver. If CAN RX messages are not showing up, check CAN High and Low with the PEAK Can Dongle or an Oscilloscope to confirm that those signals are formed properly.
Below is an example of what CAN High and Low might look like when sending a data frame over CAN. The blue line shows the voltage on CAN High, and the red line shows the voltage on CAN Low. This is what the output should look like when probing these wires with an oscilloscope.
If the voltages on CAN High and Low are not mirrored as they are in this image, there is an issue with the CAN bus. Normally, this is either a soldering or bus impedance issue. Be sure to use the FUN-E SNAIL to debug issues with the bus.