Skip to content

My car Nexa has only implemented J1979 so no passive reading of CAN data. How to send and receive response #16

@Som4567

Description

@Som4567

Hi
My car Nexa has only implemented J1979 so I am not able to read raw CAN data using MCP2515 and also with MCP2517FD but with MCP2515 I am able to send requests to CAN like RPM and able to receive responses.

My question is using MCP2517 how can I send the request and receive a response like the below code for MCP2515:

`if (useStandardAddressing) {
CAN.beginPacket(0x7df, 8);
} else {
CAN.beginExtendedPacket(0x18db33f1, 8);
}
CAN.write(0x02); // number of additional bytes
CAN.write(0x01); // show current data
CAN.write(0x0c); // engine RPM
CAN.endPacket();

// wait for response
while (CAN.parsePacket() == 0 ||
CAN.read() < 3 || // correct length
CAN.read() != 0x41 || // correct mode
CAN.read() != 0x0c); // correct PID

float rpm = ((CAN.read() * 256.0) + CAN.read()) / 4.0;

Serial.print("Engine RPM = ");
Serial.println(rpm);`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions