CAN Bus on Photon not receiving data

I’m trying to send a CANMessage from one photon to another. No Photon reports an error via errorStatus(), but nothing is received by the other photon.

I am using the tranceiver SN65HVD230 for both Photons.

This is my code for the photons:

Transmitting Photon:

CANChannel can(CAN_D1_D2);

void setup() {
    can.begin(125000);
    pinMode(D7, OUTPUT);
}

uint8_t s = 0;

void loop() {
    CANMessage message;

    message.id = 0x1;
    message.len = 1;
    message.data[0] = s;

    can.transmit(message);
    
    digitalWrite(D7, s);

    s = !s;
    delay(100);
}

Recveiving Photon:

CANChannel can(CAN_D1_D2);

void setup() {
    can.begin(125000);
    
    RGB.control(true);
    
    RGB.color(0x0000ff);
    delay(1000);
    RGB.color(0xff00ff);
    delay(1000);
}

void printStatus() {
    auto status = can.errorStatus();
    if(status == CAN_BUS_OFF) {
        RGB.color(0xffff00);
    } else if (status == CAN_ERROR_PASSIVE) {
        RGB.color(0x00ffff);
    } else {
        RGB.color(0xff00ff);
    }
}

uint8_t s = 1;

void loop() {

    RGB.color(0, 0, s ? 255 : 0);
    
    printStatus();
    
    CANMessage message;
    if(can.receive(message)) {
        RGB.color(0, 255, s ? 255 : 0);
        s = !s;
        delay(1000);
    }
}

This is my wiring:

What am I doing wrong here? May SN65HVD230 be the wrong tranceiver?

Related topics:

The 3.3V transducer is fine. It seems you are doing all the right things. You’re not missing much.

Double check your wiring.

Try using a multimeter in duty cycle measurement mode or an oscilloscope if you have access to it to see if your CAN pins are toggling or if they are remaining static.

Check with a multimeter the DC voltage of CANH and CANL. Both should be 1.5 V with a 3.3V transducer (2.5V with a 5V transducer).

Good luck finding the issue!

2 Likes

Just checked the voltage of CANH and CANL with respect to GND. It is about 1.43V on both nodes on both, CANH and CANL. Anything else that I could measure? I’m starting to think that it’s a software issue.

Edit:
I just tested the trancievers with an Arduino Due. They don’t seem to work either. So I guess the tranceivers are broken.

Edit2:
I ordered different SN65HVD230 tranceivers. It works using them. So I guess, the onces I tried were somehow broken.