Title: Working towards RPi/Arduino based interface Post by: Cadensdad14 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. Title: Re: Working towards RPi/Arduino based interface Post by: Cadensdad14 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. Title: Re: Working towards RPi/Arduino based interface Post by: Cadensdad14 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. Title: Re: Working towards RPi/Arduino based interface Post by: SERVAGA 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!! Title: Re: Working towards RPi/Arduino based interface Post by: adam- on April 19, 2020, 11:29:34 PM Fuck yes!
Title: Re: Working towards RPi/Arduino based interface Post by: noice 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. Title: Re: Working towards RPi/Arduino based interface Post by: Cadensdad14 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? Title: Re: Working towards RPi/Arduino based interface Post by: adam- 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"); Title: Re: Working towards RPi/Arduino based interface Post by: noice 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. Title: Re: Working towards RPi/Arduino based interface Post by: adam- 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? Title: Re: Working towards RPi/Arduino based interface Post by: d3irb 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. Title: Re: Working towards RPi/Arduino based interface Post by: nyet 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)
Title: Re: Working towards RPi/Arduino based interface Post by: Cadensdad14 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.
|