I have been trying to set up a CAN network using PIC18F25K80 microcontrollers and an MCP2551 to communicate between them. Can I use two simple wires as a CAN bus by just connecting the CANL, CANH of the transceivers? I couldn't even transmit data with the set up I have made with two wires! Should I terminate them with some resistance?
There is an assumption of a common 0V between the two circuits, or at least a difference between the 0Vs of the circuits within the common mode difference voltage.
For correct CAN transmission, you need
- continuous wiring between the two nodes, CANH to CANH and CANL to CANL. Not crossed over, not shorted, not open circuit. Twisted pair is not absolutely necessary at lower data rates/very short cables eg few cm at 50kbaud in the lab.
- at least one termination resistor, will not work at all without one. As data rates/cable lengths go up, you really should have one at each end, of the right value, 120R.
- at least one receiver running at the same data rate (and other bit timings) to send the ACK pulse, otherwise you get infinite repeats from the transmitter of the first message.
- common 0V reference between all nodes
The CAN bus requires terminating with 120 ohms.
I use the split termination method, with a low (10 nF) ceramic capacitor to the Vref pin on the last device on the bus. It's pin 5 on the MCP2551.