Pages: 1 [2] 3
Author Topic: Developing a Arduino Based version of ME7Logger  (Read 31052 times)
nyet
Administrator
Hero Member
*****

Karma: +607/-168
Offline Offline

Posts: 12270


WWW
« Reply #15 on: March 02, 2021, 02:42:46 PM »

And this you should never due, you're wasting a shitton of power

Code:
      while(1) {
      }   

have the decency to make that a sleep.
Logged

ME7.1 tuning guide
ECUx Plot
ME7Sum checksum
Trim heatmap tool

Please do not ask me for tunes. I'm here to help people make their own.

Do not PM me technical questions! Please, ask all questions on the forums! Doing so will ensure the next person with the same issue gets the opportunity to learn from your ex
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #16 on: March 02, 2021, 07:23:53 PM »

So the list of issues:

1.  I dont get the .h .cpp correlation yet.  That needs to be worked out properly.

2.  The arrays to configure the memory space are slightly different between the me7.5 and me7.1.1.  I need to collect more data to get this more automatic.

3.  The while loop at the end is just there to stop the program during test configuration on the bench after taking a single sample.

4.  Theres no function for saving this data.  The board I designed will write to an sd card.  Theres also the possibilty to switch to a esp32 microcontroller the send data via bluetooth or Wi-Fi.

5.  Theres no readByLocalIdentifier functions so this is far from universal.

6.  The data needs to be stored in a way that it can be loaded into ECUxPlot.

Im sure theres more, but thats a starting point.  Im expecting the PCB next week and I'll continue developing then
« Last Edit: March 02, 2021, 07:46:47 PM by Cadensdad14 » Logged
nyet
Administrator
Hero Member
*****

Karma: +607/-168
Offline Offline

Posts: 12270


WWW
« Reply #17 on: March 02, 2021, 08:23:02 PM »

So the list of issues:

1.  I dont get the .h .cpp correlation yet.  That needs to be worked out properly.
.h files have prototypes only. They're included both by cpp that implements the function and cpp that calls the function.

This is so multiple files can share the same code w/o having literally copies of the code in each.

If i have time i will refactor your code and submit a PR.. but a word of warning, it would likely end up being a complete rewrite.



Quote
3.  The while loop at the end is just there to stop the program during test configuration on the bench after taking a single sample.

i dont get this part. on an arduino, if you exit(), does the program just restart?

Quote
6.  The data needs to be stored in a way that it can be loaded into ECUxPlot.
This is csv. You'll also want to parse .ecu files for variable names and scaling.

c++ is really a bad way of doing this sort of thing, better to do it in an interpreted language like python or perl, which is why it would be ideal if cpp was used to just implement primitives that could be called from interpreted languages.
« Last Edit: March 02, 2021, 08:24:46 PM by nyet » Logged

ME7.1 tuning guide
ECUx Plot
ME7Sum checksum
Trim heatmap tool

Please do not ask me for tunes. I'm here to help people make their own.

Do not PM me technical questions! Please, ask all questions on the forums! Doing so will ensure the next person with the same issue gets the opportunity to learn from your ex
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #18 on: March 03, 2021, 12:36:40 AM »

i dont get this part. on an arduino, if you exit(), does the program just restart?

Your (setup) runs once.  Use it for allocating values at the start or starting Serial etc.
Your (loop) runs all the time.  It'll run through each line in here, process it and then do it all again until power is lost.
Logged
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #19 on: March 03, 2021, 12:37:19 AM »

And this you should never due, you're wasting a shitton of power

Code:
      while(1) {
      }   

have the decency to make that a sleep.

Arduino's don't sleep.  ESP's do.

Logged
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #20 on: March 03, 2021, 05:24:44 AM »

I'll have a play with this later but have no comms with an ESP or Mega with a Passat or VR6 ECU.
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #21 on: March 03, 2021, 06:58:34 AM »

Just checking, but do you have them running through a lm339 or 393 with the voltage dividers and pull ups?

Serial1 is the one running the K-line, Serial is running the USB.
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #22 on: March 03, 2021, 07:15:48 AM »

Nyet, please do whatever you want with this.  Ive never claimed to be any kind of authority on this.  I just wanted to put something out that could be the base of something better, because i hadnt seen this from anyone. 

Right now, once its connected and configured, it just prints the data to the serial monitor.  I need it to store a csv file to an sd card thats formatted just like the output file from me7logger for ECUxPlot.

My purpose is simple.  I cant have a laptop in the car while racing, but i can mount a headless module and collect the data and look at it after races. 

It also give me the option to write RAM variables for multimapping.  I can change pedal maps and load tables for things like wet vs dry running.  Have more data and more ways to optimize the system doesnt hurt. 

Plus ive modularized it to be able to collect 8 analog sensors, (oil and fuel pressure, front and rear brake pressure, etc) and be able to compile other realtime data from GPS, an imu, my TPMS system, and cameras.
Logged
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #23 on: March 03, 2021, 07:40:15 AM »

Just checking, but do you have them running through a lm339 or 393 with the voltage dividers and pull ups?

Serial1 is the one running the K-line, Serial is running the USB.

It's the board I had for FISBlocks so is just piggy'd onto the back of the OBD board, the same as this:
https://github.com/ibanezgomez/FISBlocks

Will it work with FISBlocks if I do it your way?
Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #24 on: March 03, 2021, 05:40:58 PM »

Im using 2 sets of 10k resistors to create voltage dividers on the logic levels.  The 12v goes through a 10k, and then another 10k to ground.  Between you get the 6V.  Same for the 3.3V to get 1.65.  Not in this schematic, theres a 1k pullup resistor on the teensy LC RX Line(TLC_RX)
Logged
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #25 on: January 07, 2023, 04:00:08 PM »

Got this built and responsive but gets stuck at init 2. Seems to be the wrong response. Anyone got further?
Logged
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #26 on: January 08, 2023, 04:23:42 AM »

Okay, changed the def for the arrays from Char to Byte and got it working.  Gets stuck at Accessing Timing Parameters.  Seems to be getting stuck in the loop:
while (Serial1.available() < (messageLength + 1)) {
    Serial.println("in while...");
    if (Serial1.available() == 0x3F) {

On the scope the Arduino transmits the correct timing chars but the ECU doesn't respond...
Logged
R32Dude
Full Member
***

Karma: +45/-10
Offline Offline

Posts: 248



« Reply #27 on: January 08, 2023, 07:39:15 AM »

I can't directly help you as I dont use arduino, but download the source for my r32logger and see the VB 6 code I wrote to connect and change timing parameters. Not sure if that version had quite the correct parameters, but they worked regardless. There are a few unfinushed loggers on here but  hopefully you can get this one to work as it should, at least as a challenge.
« Last Edit: January 08, 2023, 07:46:01 AM by R32Dude » Logged
adam-
Hero Member
*****

Karma: +124/-33
Offline Offline

Posts: 2179


« Reply #28 on: January 09, 2023, 02:39:43 PM »

Minor change in the Start Development Session:
    txBuf[0] = 0x03;  //Message Length
    txBuf[1] = 0x10;  //StartDiagnosticSession
    txBuf[2] = 0x86;  //Development Session
    txBuf[3] = 0x14;  //?? *Was 63

Changed Byte 4 to be 14, not 63 and it works!
Logged
prj
Hero Member
*****

Karma: +1072/-481
Offline Offline

Posts: 6037


« Reply #29 on: January 10, 2023, 09:34:43 AM »

I'm not sure what's going on here, but the last byte is a checksum.
In KWP2000 it's a simple unsigned 8 bit sum of all the bytes except for the checksum byte.

But not only the sum is wrong.
The length does not include the header. so the length of this message is 2. Also the packet is not just length, in this case you have a single byte header, where only the lower 0x3F are length, the upper ones are address format specifiers.
And if you want to get a packet over 63 bytes you have to send this differently.

If you add 0x02, 0x10, 0x86 together you get 0x98.

And here is the whole thing using fastinit:
Quote
[>] 81 01 F1 81 F4
[<] 83 F1 01 C1 EF 8F B4
[>] 02 10 86 98
[<] 02 50 86 D8

I mean okay, you are just cobbling something together, but I really recommend to read this here:
http://www.internetsomething.com/kwp/KWP2000%20ISO%2014230-2%20KLine%20.pdf

Logged

PM's will not be answered, so don't even try.
Log your car properly - WinOLS database - Tools/patches
Pages: 1 [2] 3
  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Page created in 0.022 seconds with 17 queries. (Pretty URLs adds 0s, 0q)