Results 1 to 15 of 40

Thread: Looking for asistance with ALDL project...

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,055
    right on

    here's a general function to generate a checksum byte with c or c++, just run it against the array

    Code:
    char checksum_generate(char *buf, int len) {
      int x = 0;
      unsigned int sum = 0;
      for(x=0;x<len;x++) sum += buf[x];
      return ( 256 - ( sum % 256 ) );
    }
    here's a function to test an incoming checksum (not that you should have to for this program)

    Code:
    bool checksum_test(char *buf, int len) {
      int x = 0;
      unsigned int sum = 0;
      for(x=0;x<len;x++) sum += buf[x];
      if((sum & 0xFF) == 0) {
        return true;
      } else {
        return false;
      }
    }

  2. #2
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    Ah yes, I had completely forgotten about the checksum! Adding in your checksum function, this is pretty much the entirety of the initial test! I'm leaving out all of the other bytes because I expect they are uneccessary. I'm assuming the gauge cluster will only look at the 5 bytes after 0x0A.

    Code:
    void setup() {
      Serial.begin(8192);
    }
    
    void loop() {
      if (Serial.availableForWrite() > 5) {
        byte b[5] = {0x0A, 0x58, 0x40, 0x0D, 0xAC};
    
        unsigned int x, sum = 0;
        for (x = 0; x < sizeof(b); x++) sum += b[x];
        byte cs = ( 256 - ( sum % 256 ) );
    
        Serial.write(b, 5);
        Serial.write(cs);
      }
    }
    It compiles without errors or warnings, but that doesn't mean my logic is sound!

  3. #3
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    Adding a little math to convert an integer RPM into MSB and LSB...

    Code:
    void setup() {
      Serial.begin(8192);
    }
    
    void loop() {
      if (Serial.availableForWrite() > 5) {
        int rpm = 3200;
        byte msb = floor(rpm / 256);
        byte lsb = rpm % 256;
        
        byte b[5] = {0x0A, 0x58, 0x40, msb, lsb};
    
        unsigned int x = 0, sum = 0;
        for (x = 0; x < sizeof(b); x++) sum += b[x];
        byte cs = ( 256 - ( sum % 256 ) );
    
        Serial.write(b, 5);
        Serial.write(cs);
      }
    }
    Now if that works, I will add a potentiometer and read that for input to convert to an rpm reading, and I should be able to control my tachometer in real time!

  4. #4
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,055
    looking good

    the third byte in your 'testing' datastream packet is probably 0x40 because your test bench had the check engine light on, so use 0x00

    you'll probably be best off introducing a small delay like delay(10) into your main loop (inside your if()) as most aldl devices can't accept data at such a high rate

    really curious to see if it works on the first try for you

  5. #5
    Fuel Injected!
    Join Date
    Mar 2013
    Posts
    1,478
    F0 56 F4 C6 0A 58 00 00 00 9E 0A 58 00 00 00 9E 0A 58 00 00 00 9E 05 5F 00 20 00 3C 7F 00 00 02 00 01 BE 0A 58 00 00 00 9E
    That is the message and here is the decoding


    F0 56 F4 C6 -message 1 broadcast message of bus master F4 indicates the id of the master
    0A 58 00 00 00 9E -message 2 to module ID $0A 3 bytes long
    0A 58 00 00 00 9E -repeat
    0A 58 00 00 00 9E - repeat
    05 5F 00 20 00 3C 7F 00 00 02 00 01 BE message 5 to module ID $05, 10 bytes long
    0A 58 00 00 00 9E -repeat

    The structure of message is as
    [05]first byte recieving module ID
    [5F]second byte length
    [00..01]message data
    [BE]checksum of message

    Decoding the 10 byte length message will get you want you need.
    I bin disassembly might get the decoding pretty fast than trying to reverse the datastream.

  6. #6
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,055
    i guess one question is does the dash even care about that initial broadcast message to go into some kind of receiving mode, or is it a simple device unaware of anything but 0A messages..? never really thought about that part of how aldl slaves work. there must be a reason for announcing broadcast mode but i always assumed their comms logic was pretty simple

  7. #7
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,055
    ahh so what it looks like it's actually doing is updating the dash with both messages. it uses the shorter message for updating RPM quickly and then periodically sends this longer message to update other parts of the dash. might want to handle both messages to update some other things on the dashboard

    Code:
    ..PAGE
    ..HEAD02L ALDL NORMAL MESSAGE *F9MSG2*
     - MESSAGE ID     = $05
     - MESSAGE LENGTH = $5F
     - DATA       NAME            DESCRIPTION
    
       1          IPMW9           MODE WORD FOR INSTRUMENT PANEL
              0     NOT USED
              1     NOT USED
              2     NOT USED
              3     NOT USED
              4      1 = DIAGNOSTIC ENABLE LINE SHORTED
              5      1 = ALDL MODE
              6      1 = SERVICE ENGINE SOON LIGHT ON
              7      1 = UP SHIFT LIGHT ON
       2         IPMW8            MODE WORD FOR INSTRUMENT PANEL
              0     NOT USED
              1      1 = FUEL SYSTEM DISABLED BY VATS
              2     NOT USED
              3      1 = MALF 24 DETECTED
              4     NOT USED
              5      1 = LOW COOLANT
              6      1 = MALF 14 OR 15 DETECTED
              7     NOT USED
       3            FILTMPH       VEHICLE SPEED
                                       MPH = N
       4            KREDLINE      REDLINE RPM
                                       RPM = N*100
       5            ADBAT         BATTERY VOLTAGE
                                       VOLTS = N/10
       6            ACUMFUEL      ACCUMULATED FUEL FOR DRIVER DISPLAY (MSB)
       7            ACUMFUEL+1    ACCUMULATED FUEL FOR DRIVER DISPLAY (LSB)
                                       MSEC = (MSB*256 + LSB)/65.536
       8            KDISF         SINGLE INJECTOR FLOW RATE IN GALLONS/HOUR (MSB)
       9            KDISF+1       SINGLE INJECTOR FLOW RATE IN GALLONS/HOUR (LSB)
                                       G/H = (MSB*256 + LSB)/6144
      10            COOLDEGA      COOLANT TEMPERATURE
                                       DEG C = N*.75 - 40
     - CHECKSUM

  8. #8
    LT1 specialist steveo's Avatar
    Join Date
    Aug 2013
    Posts
    4,055
    alternatively if the car had a second display unit somewhere for driver warning messages, maybe the second message was exclusively for that module?

  9. #9
    Fuel Injected! Quaraxkad's Avatar
    Join Date
    May 2019
    Posts
    37
    It works!

    Using this code:
    Code:
    volatile int iSparkCounter = 0;
    const int SPARK_PULSE_IN_PIN = 2;
    const int UPDATE_INTERVAL = 200;
    unsigned long lLastUpdate = 0;
     
     
    void incrementSparkCount () {
      iSparkCounter++;
    }
     
    void setup() {
      pinMode(SPARK_PULSE_IN_PIN, INPUT_PULLUP);
      attachInterrupt(digitalPinToInterrupt(SPARK_PULSE_IN_PIN), incrementSparkCount, RISING);
      Serial.begin(8192);
    }
     
    void loop() {
      if ((millis() - lLastUpdate) > UPDATE_INTERVAL) {
        int iRPM = (iSparkCounter * (1000 / UPDATE_INTERVAL) * 60) / 3;
     
        byte bMSB = ((iRPM >> 8) & 0xFFu);
        byte bLSB = (iRPM & 0xFFu);
        byte bStream[5] = {0x0A, 0x58, 0x00, bMSB, bLSB};
        unsigned int i = 0;
        unsigned int iT = 0;
        for (i = 0; i < sizeof(bStream); i++) iT += bStream[i];
        byte bChecksum = ( 256 - ( iT % 256 ) );
        Serial.write(bStream, sizeof(bStream));
        Serial.write(bChecksum);
     
        iSparkCounter = 0;
        lLastUpdate = millis();
      }
    }
    I got the following result:
    https://s3.amazonaws.com/Quaraxkad/C...24_222755.webm

    I should be able to get a faster response by reducing the update_interval value. And I can add a second ALDL message string that includes the fuel cutoff (stock is 5950), which will add a red line on the outer ring of the tachometer.

    It's late enough tonight that I don't want to floor it and piss off the neighbors, so I'll do a more thorough test tomorrow. Idle speed is roughly 750rpm, confirmed with OBDII scanner, so that checks out. We'll see what happens on the drive to work tomorrow morning. Then the next step will be assembling a circuit board with an optocoupler isolation and power input (it's currently battery powered), packing it into a nice neat box with connectors to plug in where needed, and finding a place to mount it.

    I did already notice one quirk though... I tapped the horn and the tach shot up to 7000RPM!

Similar Threads

  1. New guy old project
    By The Stickman in forum Introductions
    Replies: 1
    Last Post: 04-24-2015, 05:26 AM
  2. Need help on new project
    By SuperHbody in forum GM EFI Systems
    Replies: 0
    Last Post: 01-05-2015, 06:45 AM
  3. new here...odd project and need help
    By travisr1988 in forum GM EFI Systems
    Replies: 5
    Last Post: 04-19-2014, 06:30 PM
  4. Another TPI Project..
    By ezobens in forum GM EFI Systems
    Replies: 16
    Last Post: 01-20-2014, 05:49 PM
  5. 85 k5 project?
    By mjc in forum GM EFI Systems
    Replies: 0
    Last Post: 12-24-2013, 01:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •