synfinatic / sv650ecu

Suzuki SV650 ECU Decoder
GNU General Public License v3.0
20 stars 8 forks source link

Datastream interrupt #14

Closed gsmith1979 closed 2 years ago

gsmith1979 commented 2 years ago

HI there Aaron, Sorry not sure if this is something you have looked at in the last 7 years, but I am trying this out on a Gen2 Hayabusa (08-20) dash cluster, ultimately I am working to take a CAN input into a CANBED and then produce the data serial stream out to the dash.

Using your or some sketches similar I am able to talk with the hayabusa dash no problem and have been able to operate the coolant gauge, FI codes, ABC power mode indication, and the gear indicator. This all works wonderfully if I hard code set values and say things like temp = 100, or set the gear bits etc. The moment I bring a CAN message in and make dash items based on it, or even an analogRead command, or even try make the temperature change on it's own by every 5 or 10 seconds have it multiply by a random number so it changes, the serial stream seems to get interrupted somehow.

I have verified the gen2 hayabusa has 7800 baud rate, I have made some adjustments to the message spacing to line up with what I have observed with my scope, but I am stumped and can't seem to get the dash to consistently respond to changes coming from any external source.

Wondering if this is anything that you have encountered before in your journeys? I am not a programmer at all, my understanding is pretty limited, but seems like maybe I am missing something to make it work correctly.

I made a quick video last night for a buddy trying to help me out with the project if you were interested to take a look at what is happening. Thanks very much for the code you have posted and time spent on this!. https://www.youtube.com/watch?v=ZMGqHi9cjfo

Greg

gsmith1979 commented 2 years ago

A couple of my terrible hacky sketches attached if you were interested.

receive_TPS_new_with_Serial_works.zip

synfinatic commented 2 years ago

So semi-educated and random guess: It sounds like a timing issue. The dash is expecting 7800 baud rate. So if your code is busy and it "misses" writing a message, it would now be writing messages at an offset. Pretend each "message" is 4 bytes (I honestly forget how long it is an too lazy too look it up) the dash would expect 5 messages like this sent over the wire:

1111222233334444555

But if your script is busy during the 3rd message since it is updating and it "misses" your script might send:

1111222233_334444555

that gap means the bytes are corrupted for messages 3, 4 and 5 because the first byte of message 4 you send is interpreted as the 2nd byte of message 4 and so on.

Anyways, that's my semi-educated guess at 8pm with a glass of wine sitting on my desk. :) Good luck!

gsmith1979 commented 2 years ago

Not sure what was going on in the original sketch, but I used your temp output sketch as a starting point and was able to add CAN code to it and get can messages in properly controlling the dash with out any issues, so much appreciation for your sketches posted! Thank you Aaron!