Pages: [1]
Author Topic: Working towards RPi/Arduino based interface  (Read 7003 times)
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« on: April 14, 2020, 06:16:51 PM »

Im setting up my TT to run RallyCross and hopefully eventually stage rally.  I feel as though there is useful information to be gained from the car at times when on course.  I have been using a Windows tablet in the car but have had issues with the connection due to the course roughness.  I feel like a headless logger that could be permanently mounted would be ideal, especially something with wireless transfer capabilities.  Id also want to be able to log telemetry data in reference to the ECU data.  Im relatively new to all this, but I have gotten an Arduino Nano to read the information transfer by rebuilding the cable with a ftdi breakout and a LM339 chip up to 64 bytes when the buffer cant keep up, maybe the buffer, maybe my code.

Is there any interest in this?  I may just keep posting my progress here anyways.  Ive seen several people with this idea but the never post any progress and we all seem to start from step one.
« Last Edit: April 16, 2020, 03:36:47 PM by Cadensdad14 » Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #1 on: April 15, 2020, 07:44:53 PM »

So i found a loose wire on my breadboard.  This is the result of what I have so far:
55                               (Sync Byte)
1                                 (Keyword LSB)
8A                               (Keyword HSB)
incoming = 0F              (Block Length of 15 Bytes)
incoming = 01              (Block Count 1st block)
incoming = F6              (Block Type - ASCII)
incoming = B8              (odd but B8 - 80 = 38 or 8 )
incoming = 4E              (N)
incoming = 30              (0)
incoming = 39              (9)
incoming = 30              (0)
incoming = 36              (6)
incoming = 30              (0)
incoming = 31              (1)
incoming = 38              (8 )
incoming = 4C              (L)
incoming = 20              (  )
incoming = 20              (  )
incoming = 03              (Block End)

Going to try to parse that out and then send the ack block. 
« Last Edit: April 16, 2020, 03:34:59 PM by Cadensdad14 » Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #2 on: April 16, 2020, 06:44:18 PM »

More progress tonight.  I have it reading and responding to the initiation sequence through modules that interpret the signals.  With portions of my debugging code still included i get this as an output:
Starting
start bit sent
init comp
55
1
8A
8N0906018L 
Recieve loop complete
Ack complete
1.8L R4/5VT     G01
Recieve loop complete
Ack complete
0003
Recieve loop complete
Ack complete

Im now past the initial 4 slave blocks and am ready to take on the roll of the master in the system. 

Ive attached the sketch so far.
Logged
SERVAGA
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


« Reply #3 on: April 19, 2020, 12:43:22 PM »

Good job!! This is very interesting for controlling critical variables in our engines.
Maybe could attach some pictures to see how is it working?
Thank you very much for this!!
Logged
adam-
Hero Member
*****

Karma: +123/-33
Offline Offline

Posts: 2179


« Reply #4 on: April 19, 2020, 11:29:34 PM »

Fuck yes!
Logged
noice
Newbie
*

Karma: +16/-3
Offline Offline

Posts: 23


« Reply #5 on: April 20, 2020, 02:00:08 PM »

My 2 cents:KWP2000 Logger Arduino sketch attached.

Wrote in the dumbest way possible, but it works.

Did this sniffing ME7Logger.

Logged
Cadensdad14
Full Member
***

Karma: +8/-1
Offline Offline

Posts: 134


« Reply #6 on: April 21, 2020, 08:32:19 PM »

Im not here claiming to know how to program.  What I do have going for me on what Ive written is that i can plug in any ECU and get it to run through the initial slow connection.  Ive sniffed the KWP2000 initialization and am going to start working through that next.  Right now Im just trying to give myself proof of concept.  While what you've written may work for your ECU, it wouldn't work with anyone else's.

So where can I improve the code?  Clearly I need to be including a better debugging plan that just deleting the print commands when things work and adding error codes.

Also, how long is the timing break between the 2 ack blocks at the end of the KWP1281 phase and the slow init wake up for the KWP2000 phase? 
Logged
adam-
Hero Member
*****

Karma: +123/-33
Offline Offline

Posts: 2179


« Reply #7 on: April 22, 2020, 01:54:53 AM »

Define this at the top:
#define DEBUG true  //set to true for debug output, false for no debug ouput
#define DEBUG_SERIAL if(DEBUG)Serial

Change your Serial.print to DEBUG_SERIAL...
DEBUG_SERIAL.println("Some debug output");
Logged
noice
Newbie
*

Karma: +16/-3
Offline Offline

Posts: 23


« Reply #8 on: April 22, 2020, 05:03:57 PM »

Im not here claiming to know how to program.  What I do have going for me on what Ive written is that i can plug in any ECU and get it to run through the initial slow connection.  Ive sniffed the KWP2000 initialization and am going to start working through that next.  Right now Im just trying to give myself proof of concept.  While what you've written may work for your ECU, it wouldn't work with anyone else's.

So where can I improve the code?  Clearly I need to be including a better debugging plan that just deleting the print commands when things work and adding error codes.

Also, how long is the timing break between the 2 ack blocks at the end of the KWP1281 phase and the slow init wake up for the KWP2000 phase? 

I said my logger was written on the dumbest way possible, not yours. Sorry if it sounded the other way.

Logged
adam-
Hero Member
*****

Karma: +123/-33
Offline Offline

Posts: 2179


« Reply #9 on: April 24, 2020, 12:47:46 AM »

Implementation is good, I've not tried to compile.  The bit that I'd like to see is grabbing the .ecu files and using the variables you want to log and parsing them.

Not sure what you plan on devoloping this on?  I was using Megas but have moved to the ESP32, which offers WiFi/bluetooth and pretty much every pin can be used as an interrupt.  Do we have source code for ME7Logger?
« Last Edit: April 24, 2020, 01:01:48 AM by adam- » Logged
d3irb
Full Member
***

Karma: +134/-1
Offline Offline

Posts: 195


« Reply #10 on: April 24, 2020, 09:24:59 AM »

Do we have source code for ME7Logger?

No, but this thread covers everything you should need:

http://nefariousmotorsports.com/forum/index.php?topic=271.0title=

Me7Logger uses a few additional tricks but the simple summary of how it works is that it uses a development mode session and WriteMemory to define LocalIdentifier tables pointing to the RAM addresses in the .ecu file without the restrictions in the DefineLocalIdentifier handler, then uses ReadLocalIdentifier to read the defined LocalIdentifiers. You can also use ReadMemory directly in development mode, which is probably a lot easier but a good bit slower since you have to make a separate request for each non-contiguous RAM variable.
Logged
nyet
Administrator
Hero Member
*****

Karma: +607/-168
Offline Offline

Posts: 12268


WWW
« Reply #11 on: April 24, 2020, 09:38:25 AM »

Btw there is some code in the nefmoto flasher that does this (it has a logger built in)
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 #12 on: April 25, 2020, 03:37:16 PM »

I've seen the stuff for the nefmoto software but I don't have a solid enough grasp on C# and dlls to understand the nefmoto code.  Today I got the echo running through the RPi serial and am hoping to have a RPI version of this running before too long.  The UART port on the pi is a pain compared to the Arduino.
Logged
Pages: [1]
  Print  
 
Jump to:  

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