Announcement

Collapse
No announcement yet.

SMG CAN Bus Decoding

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #46
    It's the same like on www.ms4x.net just as Excel

    Comment


      #47
      Hi guys,

      I've got it

      First of all, the description of Byte3 on www.ms4x.net is not absolutely correct... As I said before, there are two signals with 4 bits each in here.

      That means:

      Byte3:
      • ALIVE_COUNTER[0 - 3]
      • GEAR_INFO_CHECKSUM[4 - 7]
      There are two posibilities to set (and to calculate) checksum:
      • Nibble by Nibble:
        • Set the ALIVE_COUNTER signal in Byte3 (lower nibble)
        • calculate and set CHECKSUM signal in Byte3 (higher nibble)
      • whole byte:
        • put GEAR_INFO and ALIVE_COUNTER into calculation function and set the whole Byte3 at once.
      I prefer the "whole byte" methode and here is the code for it:

      Code:
      int calculateChecksum(int l_gear_info, int l_alive_counter)
      {
        tmp1 = (l_alive_counter ^ l_gear_info);
        tmp2 = ~(tmp1);
        tmp3 = (tmp2 & 0x0f);
        tmp4 = (tmp3 << 4);
       
        // here says www.ms4x.net: CHKSM_GEAR_INFO = Or CHKSM_GEAR_INFO , GEAR_INFO
        // and it is wrong, because we don't have the counter value in Byte3.
        // the correct value is:
        tmp5 = (tmp4 | l_alive_counter);
      
        return tmp5;
      }​
      The variable tmp5 contains both signals, ALIVE_COUNTER and CHECKSUM.

      Comment


        #48
        Nice job you all are doing here!
        I have been in to CAN-BUS for a while and stumbled over that specific checksum byte/nibble in many messages from various ECUs my self. Nice job you have found it. 💪
        I suppose there are many other calculations manufacturers can choose for this checksum.

        Comment


          #49
          Thank you!

          Originally posted by Tomba View Post
          I suppose there are many other calculations manufacturers can choose for this checksum.
          Well, there is no "general formula" for calculating the checksum, every manufacturer does it somehow differently. The checksum also does not exist in every message.

          With the E65 (for example) the checksum (at least in the PT_CAN) is calculated over the whole message by adding the single bytes to each other, then adding with overflow and so on. The checksum is 8bit long.​

          Comment


            #50
            Originally posted by HeinrichG_V12 View Post
            Thank you!



            Well, there is no "general formula" for calculating the checksum, every manufacturer does it somehow differently. The checksum also does not exist in every message.

            With the E65 (for example) the checksum (at least in the PT_CAN) is calculated over the whole message by adding the single bytes to each other, then adding with overflow and so on. The checksum is 8bit long.​
            Do you have some info on the PT_CAN bus checksum? How did you find it out?

            Comment


              #51
              Originally posted by HeinrichG_V12 View Post
              Thank you!



              Well, there is no "general formula" for calculating the checksum, every manufacturer does it somehow differently. The checksum also does not exist in every message.

              With the E65 (for example) the checksum (at least in the PT_CAN) is calculated over the whole message by adding the single bytes to each other, then adding with overflow and so on. The checksum is 8bit long.​
              This is the most common version of a checksum. Also often used in Kline or KWP communication, before trying anything else (only if the checksum is always the same of the message repeats, so no alive counter), try this.
              …under construction.

              Comment

              Working...
              X