collin80 / SavvyCAN

QT based cross platform canbus tool
MIT License
986 stars 275 forks source link

ISOTP-Decoder values incorrect #325

Open mickeyl opened 3 years ago

mickeyl commented 3 years ago

On macOS 11 w/ QT 5.15, I found a problem in the values of a capture UDS communication, where the values of p2max and p2*max are much too high (512ms and 51200ms shown). After setting a breakpoint in uds_handler.cpp:380, it looked like a problem with

    const unsigned char *data = reinterpret_cast<const unsigned char *>(msg.payload().constData());

For some reason this leads to data pointing to 0x8002001400c800 instead of the expected 0x02001400c800 – which then makes the computation

                int p2 = data[1] * 256 + data[2];

take the wrong values. Any idea what could cause this offset?

collin80 commented 3 years ago

Well, that's an odd one. I can see that it did in fact leave the pointer alone except that it added 0x80 to the beginning of the address. I wonder if this added offset means something to MacOS?! That new address is WAY up there in virtual memory. It must mean something but I've been unable to figure out what. I suppose I might be able to work around this but I'm pretty sure this does not happen on Windows or Linux.

Alex-Markov commented 1 year ago

This does happen on Windows version V207. See below. Correct value should be 50ms (0x0032)1 and 5000ms (0x01F4)10. I think the program just uses wrong bytes.

Raw Payload: 0x50 0x03 0x00 0x32 0x01 0xF4

UDS Positive Response Service: Diagnostic session control Session Request: Extended Diagnostics Session P2MAX (Max Wait / Resp Time): 768ms P2 Ext MAX: 128010ms