So spent a bunch of the time in the garage this weekend working on reverse engineering the SDS protocol on the SV650. SDS is basically ISO9141 aka K-Line which something you often see in a car’s ODB-II port. Unfortunately, SDS is just different enough that you can’t use any commercial off the shelf ODB-II reader to read the messages. The way I have been going about this was pretty painful and taking a lot of time/effort to iterate over so I came up with a new tool chain.
I’m still using a Teensy, but instead of trying to do the full decoding on the microcontroller, it now only handles decoding the frames from the ECU and prints a CSV list of bytes via serial.
Now I’m using a Python script to do all the decoding of the actual message. Much faster to iterate over my ideas and I can do cool things like saving the raw bytes, change my code and compare the results. No more uploading code to the Teensy and writing Python code is much faster then Processing. Another big advantage is that I can save the raw messages to a file and work on my decoder from my couch/etc rather then being stuck all day in the garage because I no longer have to be wired into the bike.
This was good, but what I really wanted to do was find a way to easily compare the data from my cheap Chinese SDS tool and mine. The SDS tool has a CSV output for up to 4 sensors at a time, but there is no time stamps so it’s hard to know what records should match up since there are 10 messages per second. I came up with the idea of using the gear position sensor (GPS) which has 7 possible values (1-6th gear + neutral). If I could emulate the GPS I could create a pattern that should be easy to recognize in the data stream.
Luckily, the GPS circuit is pretty simple:
I also was getting tired of everything be wired up on a breadboard- really easy to accidentally pull a wire and then spend the next 10 minutes debugging why things don’t work anymore:
So I designed a PCB to allow me to emulate the GPS sensor and lie to the ECU about what gear the bike is in while listening to what the ECU has to say over SDS:
Ended up being a really easy board to design. I’m still using the ST L9637 chip to handle the K-Line/ISO 9141 duties, a Teensy 2.0 as the “brains” and now 6 resistors controlled by 6 transistors to select which gear the bike is in. I just ordered the boards from the awesome OshPark and I should get them in about 10 days.