Go Down

Topic: Bike interface OBD (Read 46804 times) previous topic - next topic

1ExcalibuR2

#90
Oct 11, 2016, 11:19 am Last Edit: Oct 11, 2016, 11:46 am by 1ExcalibuR2
Quote
So you should regulate the power, but it can handle up to 45V. I don´t think it will overheat that fast.

Your code will not work and never receive any data.
The Diagnostic System has to be awaken by a fastInit Sequence.
On the second page, cyclegadget describes how to do it (also explained in the ISO 14230 documentation).
Hi Trib, thanks for your answer
I have fixed my MC33290, my fault is using diode for 5v which is power for MC33290 is 12V. But when I replace my diode for 15v it's not overheating again

Quote
Then the ECU will listen for about the next 2 Seconds.
Afterwards you´ll have to activate the communication by sending:
0x81,0x12,0xF1,0x81,0x05
Now you will receive the first answer:
0x81, 0xF1, 0x12, 0xC1, 0xEA, 0x8F, + Checksum
which means C1 is 81 with 40 added. That means the submitted Service ID was succesful.
EA and 8F are decimal 243 & 143, which describe the supported format (Header type: Source, Target, Length & Checksum)

You can find all the required information here in this thread and on o5i_´s GitHub.
I have read again to page 3, and I got the code


Code: [Select]

#define TX 18
#define console Serial
#define cbaud 115200
#define sds Serial1
#define sdsbaud 10400

//variables
byte message[6] = {
  0x81,0x12,0xF1,0x81,0x05};

void setup() {
  console.begin(cbaud);
  pinMode(TX, OUTPUT);
}

void loop() {
  datastart();
}

/////////////////DATA START///////////////
void datastart(){
  digitalWrite (TX, HIGH);  // makes K-line high 3
  delay(2000);             // wait for K-line to be clear 3
  digitalWrite (TX, LOW);  // makes K-line low  3
  delay(25);
  digitalWrite (TX, HIGH); // makes K-line high  3
  delay(25);               //last delay before first message
  sds.begin(sdsbaud);  // baud rate of the OBD
  //send package 0x81,0x12,0xF1,0x81,0x05
  for (int i = 0; i < 5; i++){
    sds.write(message[i]);
    byte inByte = sds.read();
    console.print(inByte,HEX);
    delay(1);
  }
  console.println();
  while (!sds.available());
  while (sds.available()) {
    console.println(sds.read(),HEX);
  }
}


but when I copy paste this code I have an error like this


I add some softwareserial for handling this error Serial1 and it's ok


I'm still confuse on how to MC33290 communicate with arduino. when I read the code my assumtion is Tx pin 18 is using for embed fastinit to communicate with MC33290. But for what console serial is ?

TriB

Hello 1ExcalibuR2,

the code is incomplete. And very, very rudimentary.
First of all, you will have to initiate the SoftwareSerial with your matching Pins:
Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial sds(18, 19);

Serial instead, uses Pin 0 & 1 by default. Or the USB, if connected.

Then, the datastart()-method is called forever in the loop(). That´s quite bad and unnecessary.
Just do the initiating stuff only once! From then on, you can submit PID 0x08 within the loop and exclude the needed information from the response.

Something like (just pseudo-code):
Code: [Select]
loop()
{
  if(!Initiated)
  {
    datastart();
    Initiated = TRUE;
  }
  else
  {
    sendPid(0x08);
  }

  while (sds.available())
    Serial.println(sds.read(),HEX);
}

void sendPid(uint8_t pid)
{
  //Create Header:
  0x81,0x12,0xF1...
  //Attach pid
  + pid
  //Add Checksum
  + checksum
  //Send to sds
  sds.write()
}

1ExcalibuR2

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial sds(18, 19);


So the sds is a serial software Tx, Rx that connect into IC ISO-Kline, isn't it ?
When I browse about Serial1, Serial1 is just work on arduino Mega. So if I want to use Arduino UNO I must use software serial or pin 0 & 1 ?
which one is good ?

TriB

#93
Oct 11, 2016, 03:55 pm Last Edit: Oct 12, 2016, 10:56 am by Trib Reason: Mega Serial Ports correction
Yes, sds is the SoftwareSerial.
It can nearly use every Pin on the Board. Exceptions are listed on the datasheet (Like 0 & 1, because they are used by Hardware-Serial).

You have 18 & 19 connected to IC´s Rx and Tx. So you can initialize it with sds(18,19).

The Mega has two Hardware Serial-Ports: Serial and Serial1.
Like CrossRoads says, it has 4. My bad :(

It is always better to use the hardware Serial. Because it can buffer some data and works faster. But I think for your use case, it does not matter at the first place.
To debug what you are doing, I´d use SoftwareSerial and leave the Serial (0,1) to the SerialMonitor, like your example does.
When everything works, you can change it to the Hardware Serial.

CrossRoads

"The Mega has two Hardware Serial-Ports: Serial and Serial1."

Correction: The Mega has 4 hardware serial ports, Serial, Serial1, Serial2, Serial3
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

o5i_

I had to change the timers for the Softserial, if you can i recomend use the HardwareSerial...
Here is the last updated code...
https://github.com/o5i/Datalogger/blob/master/SDS_Logger_0.0.7/SDS_Logger_0.0.7.ino

TriB

Just bought a Suzuki Gsx R 600 K6 (2006)

So, I will keep up creating a Kawasaki and Suzuki compatible software :)

She (off course a baby girl) will be picked up next week. Then, the hacking will keep going on :D


In some different forums, it says the K-Series has a K-Line and OBD. This has to be investigated quite well! Also it should be possible to rewrite the ECU, as I read  :o But I´m afraid about doing things like that!

Another thing is, it has already has a PowerCommander, which also got an interface. I´m curious about all the possibilities!!!

I´ll keep you up to date  :smiley-cool:

James4

Could you post some pictures of this project please? I like it and i wanna try it.

TriB

Hi James,

pictures from what exactly?
In this thread you will find several code-snippets and links to working solutions.
Also the schematics are discussed. To understand what´s needed, I recommend reading this thread.

Until now, I only have a working solution for Kawasaki. But next week I´ll start hacking my new owned Suzuki GSX R.

How the final result look like, you can see here:
Kawasaki KDS to Buetooth

aster94

Just bought a Suzuki Gsx R 600 K6 (2006)

So, I will keep up creating a Kawasaki and Suzuki compatible software :)

She (off course a baby girl) will be picked up next week. Then, the hacking will keep going on :D


In some different forums, it says the K-Series has a K-Line and OBD. This has to be investigated quite well! Also it should be possible to rewrite the ECU, as I read  :o But I´m afraid about doing things like that!

Another thing is, it has already has a PowerCommander, which also got an interface. I´m curious about all the possibilities!!!

I´ll keep you up to date  :smiley-cool:
I am happy to know about your new girl!

About the power commander i ve heard that it just modify the signal from the sensors. So no direct interface with the ecu. A well know mechanical said me that for this reason is "shit" compared to yoshimura

For now i stopped my project since i m waiting an arduino mega, i want to have two hardware serial port to check all and not damage nothings

o5i_

You can do much more by reflashing the ecu.. But its difficult to find information about..
>>>Here<<< you go
Im curious to se your interfaces, nice work guys


TriB

You can do much more by reflashing the ecu.. But its difficult to find information about..
>>>Here<<< you go
Im curious to se your interfaces, nice work guys
Yes, I´ve seen that already. The Suzuki seems to be completely rewritable.
Some Guys decompilated the whole firmware and are able to change the mapping.
Maybe I´ll try to investigate that later on. At the first place, I want to have my Kawasaki solution also running on the Suzi.


About the PowerCommander:
That´s right. It just fakes some sensor data to change injection and stuff. Not the finest way to tune, but the easiest and compatible to the most bikes.
It should have an interface, which probably allows to reuse my solution also at not supported manufacturers (bmw, ktm, honda, ect.).
We will see!

aster94

#102
Mar 17, 2017, 05:59 pm Last Edit: Mar 18, 2017, 03:23 am by aster94
Using the l9637 i am facing some bouncing problems, some of you have had similar problems? I send a request and i receive the eco of my request with the answer from the ecu
How did you resolvered?

o5i_

You can use it to check the transmission by comparing it to the sended bytes...

aster94

My goal would be to have an hardware polish of these ecos. In software i eliminated them with a simple Serial.read()

Go Up