Electronic – arduino – Simple CAN bus design, communication issues

arduinocancontrollermicrocontrollertransceiver

I am trying to get some simple communication between two boards that I've designed with an ATmega328P microcontroller and MCP2515/MCP2551 combination.

The design is as follows:

MCP2515/MCP2551 combination design

I have both ends terminated with the 120 Ω resistor and jumper soldered. My multimeter reads 60 Ω between CANH and CANL on both sides. Both boards share the same power supply (common 5 V rail, common GND).

Software side, I am using an Optiboot bootloader and the Arduino environment for faster prototyping. (I set both my controllers on NormalMode with default filters a.k.a receive all for testing). I've tried a lot of libraries for the MCP2515, and software don't seem to be the problem.

Two of the best libraries I've found:

My problem is that I can't get the communication to work.

The boards won't receive messages from each other, while they can receive messages from a third-party board, but still can't send to said board.

As you can see I have RX_CAN and TX_CAN probe points between the transceiver and controller. Scoping TX_CAN on the transmitting board and RX_CAN on the receiving I get this weird behavior when I zoom in a single low portion of the message (yellow is the RX_CAN).

I've already tried replacing the controller and transceiver chip. Could this be a bad decoupling capacitor?

Enter image description here

Update:

After removing the LEDs, which was the problem for the weird noise, I still can't get the signal on the receiving side to follow the rest,
Shouldn't the CANH/CANL signals be opposite?

Enter image description here
The first two are CANH/CANL. Pink is TX on the transmitter side and blue is RX on the receiver side.

mcp2551 pcb layout

mcp2551 pcb layout

Best Answer

If I understand correctly you can receive CAN messages, but not send... That sounds like a transceiver problem. I realize you have replaced it already, but I would try replacing the MCP2551 with an MCP2561 or similar. They seem to be a bit more resistant to damage from ESD/handling.

I would also consider adding a CAN bus protection diode to the board.