3
\$\begingroup\$

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

\$\endgroup\$
  • 1
    \$\begingroup\$ I think it's notable that the spikes you're seeing on RXCAN are at 1MHz...about what you would expect if something was trying to communicate at CANBUS's maximum 1MBps. Why you would be seeing those spikes at all if TXCAN is always dominant is puzzling, though. \$\endgroup\$ – 1N4007 Nov 13 '17 at 22:27
  • 1
    \$\begingroup\$ Are you sure you can sink the 3-4 mA from driving those LEDs on the CAN signal lines? \$\endgroup\$ – Lundin Nov 15 '17 at 12:18
  • \$\begingroup\$ @Lundin oh well seems that might be the problem.. gonna check it \$\endgroup\$ – George TG Nov 15 '17 at 12:43
  • 2
    \$\begingroup\$ Indeed the signals should be differential. Follow the signals with the scope, from the transceiver pins and out towards the connectors. \$\endgroup\$ – Lundin Nov 15 '17 at 15:50
  • 2
    \$\begingroup\$ Leavning pin 5 (Vref) floating is fine. Pin 8 should be tied to ground in the normal case. The layout looks fine as far as I can tell. \$\endgroup\$ – Lundin Nov 21 '17 at 7:48
2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ Yeah I have some new 2551 on the way already, gonna see if that was the problem! \$\endgroup\$ – George TG Nov 20 '17 at 1:24
  • 2
    \$\begingroup\$ To kill these circuits is quite hard. In terms of ESD or transients, there are few IC:s that are more rugged. The only time I've managed to kill a MPC2551 was when accidentally leaving a pin shorted against 24V. \$\endgroup\$ – Lundin Nov 21 '17 at 7:35
  • 3
    \$\begingroup\$ Turns out all of the transceivers I had where bad, maybe the store where I bought them from had them stored in bad conditions, or they were counterfeit or something. \$\endgroup\$ – George TG Nov 22 '17 at 0:43
  • \$\begingroup\$ Maybe not that Important but I have a very similar design and it worked when I placed a 10K resistor on the RS pin and to GND "1.7.8 SLOPE RESISTOR INPUT (RS) The RS pin is used to select High-Speed, Slope-Control or Standby modes via an external biasing resistor. " If you place it on gnd directly you are selecting HIGH SPEED you should not go all full speed this can be checked on your Vr pin or pin 5 on the transceiver with a multi-meter and in the datasheet there is a chart you can compare to \$\endgroup\$ – Tjaart van aswegen Jan 6 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.