dominickpastore / aldl_echo

A simple python program to echo data parsed from an ALDL stream
19 stars 5 forks source link

Checksum und DS file Questions #1

Open knight-research opened 3 years ago

knight-research commented 3 years ago

Hi, I hope you´re still here.. :) I have a problem and try to fix it. I need to use the A057.DS file for my Pontiac this file works with ALDLScan Android app an TunerPro for Windows I setup my USB device to ACM0 and try to connect, But I always get a Checksum Warning "Msg: f4 57 01 40 ff" In aldlecho.py I see at line 193 it waits for a 0xf4 to read the data. I´ll get that:

New Message

ID: 0xf4 Mode: 0x01 Body:
01: 0X00 0000 0000 Warning: Checksum fail. Msg: f4 57 01 40 ff

maybe you know why?

dominickpastore commented 3 years ago

Still here! But I haven't touched this code in ages. I don't even remember how finished it was. Let me look, though.

knight-research commented 3 years ago

I just tried as much as I can for myself :D e even diddn´t figuret out where and how the programm loads the DS files for me it looks like everythin is hardcoded in the .py at line 290 and the DS file is ignored. But I´m still not so deep in this programm. Edit: Ok just found it at 337

dominickpastore commented 3 years ago

Ok, so here's what I've learned:

  1. The code reads the DS file, but doesn't do anything else with it. My original intention was to make it decode the messages it receives according to the DS file, but apparently I didn't get that far before losing interest. Currently, it looks like it just verifies the checksum, then prints the message ID, message mode, and raw bytes from the body in hex, binary, and decimal.

  2. I think the first message in your output is just the program's transmitted request, read back at the same time. (I'm not sure what hardware you're using to connect, but the hardware I used was just a regular USB to serial chip. The ALDL connector uses the same pin for both TX and RX, so my USB serial chip would read back its own transmissions as well as the car's, and I hadn't added anything to the program to filter those out.)

  3. Because of (2), I think the next message with the bad checksum error is the first response message from the car. One thing I noticed in my code is that the comment above the checksum calculation says it's one's complement, but the actual code does a two's complement, so it might be calculating the checksum wrong. That said, if the message was read correctly, the last byte, 0xff isn't the one's or two's complement of the sum of the first four (mod 256). So I'm not sure what's going on there.

Just to make sure I understand, when you try ALDLScan and TunerPro, they do work, or no?

knight-research commented 3 years ago

Okay, yes ALDLScan and Tunerpro are working. I just need something for raspberry to make my KnightRider Dash. As I saw you have adata_engine.txt there in line 23 for example you read out something from your car. Databyte 10: 0x96 1001 0110 150 so it´s HEX BIN DEC depending on the DS file it´s the RESCALED TPS Position. I´m using this adapter from 1320 Electronics: http://www.1320electronics.com/12pin_ALDL_BT_USB_MK2.html It´s working fine on Windows and Android.

dominickpastore commented 3 years ago

Ok. I'm going to guess that your adapter is more advanced and doesn't echo the transmitted messages back.

My code is probably doing something wrong, either because I made a mistake or because my understanding of ALDL was wrong. The latter is especially possible since I couldn't find much documentation, so it was very much a trial and error process getting anything to work.

I'll have to look into this some more, but I won't be able to get to it until later today.

knight-research commented 3 years ago

I´m not in a hurry, I also want to test check and understand it. These data_engine.txt is only a copy paste from the terminal as I saw. Here in Germany its also late and I´ll see if I can figure out someting at the weekend. And thanks that you have still time for this

dominickpastore commented 3 years ago

Ah, so you're right, there are some parts that are hard coded. I was thinking that the command to put the ECM in "transmit fixed data stream" mode was the same across models, but it's not. Try changing line 292 from:

message_send(s, 0xf4, 0x01, b'\x00')

to:

message_send(s, 0xf0, 0x01, b'')

and see what happens. Hopefully you'll get data, but I'm still wondering if it'll pass the checksum. But if so, the code still isn't there to parse the resulting message, so that will still take more work.

knight-research commented 3 years ago

Morning, testet it before work. Still Checksum fail f4 56 01 15. always differrent numbers, only f4 56 is always the same