CANbus giving unexpected messages

I am trying to integrate my Electron (OS 1.5.2) with a CANbus enabled device. I currently have a transceiver (SN65HVD230) connected to the CAN TX and RX lines of the Electron with the CANL and CANH connected to the appropriate lines of the device.

I am not receiving valid responses from the device so I hooked up a oscilloscope (shown below) and found that the Electron is sending and receiving the same hex value over and over again at a much faster rate than expected which is creating an invalid CAN message. I am fairly new to CANbus so I might be utilizing CANbus incorrectly.

Any help would be much appreciated.

The above picture is running the code below

SerialLogHandler logHandler;
CANChannel can(CAN_C4_C5);

void setup() {

void loop() {
  CANMessage message; = 0x100;
  message.len = 1;[0] = 42;

  int status = can.errorStatus();
  if(can.errorStatus() == CAN_BUS_OFF) {"Not properly connected to CAN bus");
  } else if (status == CAN_ERROR_PASSIVE) {"Passive");
  } else {"Connected");
  }"Available: %i", can.available());"Enabled: %i", can.isEnabled());



As of now, the queue keeps getting populated with messages until it runs out of room. Below is the continuous output I am receiving.

0000060598 [app] INFO: Passive
0000060598 [app] INFO: Available: 0
0000060598 [app] INFO: Enabled: 1
0000061599 [app] INFO: Passive
0000061599 [app] INFO: Available: 0
0000061599 [app] INFO: Enabled: 1
0000062599 [app] INFO: Passive
0000062599 [app] INFO: Available: 0
0000062600 [app] INFO: Enabled: 1
0000063600 [app] INFO: Passive
0000063600 [app] INFO: Available: 0
0000063600 [app] INFO: Enabled: 1
0000064600 [app] INFO: Passive
0000064601 [app] INFO: Available: 0
0000064601 [app] INFO: Enabled: 1

Do you have 120 ohm termination resistors on both ends of the CAN bus? There should be exactly two, one at each end and none at any intermediate nodes (if any).

It looks like your transceiver on the Electron has the terminator always enabled, but you need one on the other end as well.

If you’re tapping into the middle of an existing CAN bus, you’ll need to remove the termination resistor on your transceiver. Many of them have a jumper for that, but unfortunately the one linked above does not.

1 Like