0

Background / Introducion

CAN message Mercedes-Benz, cannot determine 16-bit data type for temperature.

7E 00 32 01 37 00

According to @rnd-ash (who has reverse engineered ACTIA Basic XS Monitor Software) message is structured data type composed of four values. Now we have bit length + offset but unfortunately data type is unknown.

ECU NAME: SAM_V_A2, ID: 0x0017. MSG COUNT: 4
    MSG NAME: T_AUSSEN_B - (°C) (° C) Outside air temperature, OFFSET 0, LENGTH 8
    MSG NAME: P_KAELTE - (bar) (Bar) pressure refrigerant R134a, OFFSET 8, LENGTH 16
    MSG NAME: T_KAELTE - (°C) (° C) temperature refrigerant R134a, OFFSET 24, LENGTH 16
    MSG NAME: I_KOMP - (mA) (MA) current compressor main control valve, OFFSET 40, LENGTH 8

@ProjectPhysX suggested it is probably 8/16-bit integer and big endian, so I created that struct. Figured out how to calculate value 0, 1, 3 but unfortunately struggling with value 2

typedef struct SAM_V_A2_t {
  uint8_t T_AUSSEN_B;
  uint16_t P_KAELTE;
  uint16_t T_KAELTE;
  uint8_t I_KOMP;
} SAM_V_A2_t;

Based on that pictures I can confirm the calculation except for T_KAELTE, which is target of this question (see below).

std::cout << "T_AUSSEN_B = " << +( (SAM_V_A2.T_AUSSEN_B - 80) / 2 ) << " (°C) Outside air temperature"               << std::endl;
std::cout << "P_KAELTE = "   << +( SAM_V_A2.P_KAELTE / 10 )         << " (bar) pressure refrigerant R134a"           << std::endl;
std::cout << "T_KAELTE = "   << +( (SAM_V_A2.T_KAELTE - 80) / 2 )   << " (°C) temperature refrigerant R134a"         << std::endl;
std::cout << "I_KOMP = "     << +( SAM_V_A2.I_KOMP * 10 )           << " (mA) current compressor main control valve" << std::endl;

  7E             00 32               01 37             00

01111110   00000000 00110010   00000001 00110111   00000000

 126               50                 311               0

 126 - 80 / 2      50 / 10             ?                0 * 10

  23°C              5 bar              ? °C             0 mA

Question

My last hope was it could be binary16 or bfloat16 but no luck. Maybe it is some proprietary 16-bit floating-point format with different bits for exponent / mantissa

Maybe we can brute force all permutations for exponent / mantissa to determine data type.
Question: How can we decode 01 37 so it gives expected value ~ 21.10 °C

(more sample data here)

4
2

Maybe it is the temperature in Kelvin: 311 - 80/2 = 217K = -2.15°C

Or the offset is different than 80/2. A 16-bit floating-poitn format, especially a different one from IEEE-754 is highly unlikely. Such measurement chips are not more but simple ADCs, they lack the capabilities to convert their reading to floating-point.

To be sure, you would have to take several readings. If you expect that temperature fluctuates by a few °C between measurements, then in 00000001 00110111 only the last few bits should change.

If you have access to the hardware, read the serial number off the chip package and look it up, maybe you find the data sheet that documents the data format of measurements.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.