arduino-CAN icon indicating copy to clipboard operation
arduino-CAN copied to clipboard

Not able to get Ecu data from Jeep compass

Open Nikhil0351 opened this issue 5 years ago • 1 comments

Hello sir, Im trying to receive the data from jeep compass ecu. Using the Can_receiver sample program we are getting different data.

Im trying the engine rpm example code.

// Copyright (c) Sandeep Mistry. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//
// This examples queries the engine RPM (OBD-II PID 0x0c) once a seconds and
// prints the value to the serial monitor
//
#include <CAN.h>

// Most cars support 11-bit adddress, others (like Honda),
// require 29-bit (extended) addressing, set the next line
// to true to use extended addressing
const bool useStandardAddressing = true;

void setup() {
  Serial.begin(9600);

  Serial.println("CAN OBD-II engine RPM");

  // start the CAN bus at 500 kbps
  if (!CAN.begin(500E3)) {
    Serial.println("Starting CAN failed!");
    while (1);
  }

  // add a filter to only receive the CAN bus ID's we care about
  if (useStandardAddressing) {
    CAN.filter(0x7E8);
  } else {
    CAN.filterExtended(0x18daf110);
  }


  
}

void loop() {
  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();

  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);
   delay(1000);
   
}

what could be the issue? Please help me.

Best regards.

Nikhil0351 avatar Jan 29 '20 07:01 Nikhil0351

is the Jeep 8 bit or 11 bit CAN ID?

const bool useStandardAddressing = true;

Try false here maybe it work. Check connections

Petros144 avatar Mar 16 '20 11:03 Petros144