Issues with signed CAN message

D153, D175, C125, C127, C185 and C187 forum

Issues with signed CAN message

Postby FrankL on Mon Nov 13, 2023 12:44 pm

I logging a CAN Bus on a production motorcycle using a C185.
I have some issues with a CAN channel that is being signed against my will.
The CAN address is set up as Fixed Binary, Normal alignment and Standard Length (not extended)

It seems that even if I don't check the sign box, the channel was logged or interpreted as a signed channel. But when displaying the value on the dash the value is not signed. As seen in the first pic, it seems the channel is changing from 2 bytes to 4 bytes when it changes to negative. I have tried to change the output length from Auto to 2, but I saw no change.
Sign-Unsign.jpg
Sign-Unsign.jpg (171.02 KiB) Viewed 2473 times

Any idea what I am doing wrong?
How can I fix that?

I finally was able to log the channel as it is broadcast by the ECU using the following setup. See second pic.
I would prefer to avoid this option and make it work properly at 2 bytes.
Mask.jpg
Mask.jpg (61.25 KiB) Viewed 2473 times


Frank
FrankL
 
Posts: 23
Joined: Sat Jan 16, 2016 5:39 am
Location: Québec, Canada

Re: Issues with signed CAN message

Postby David Ferguson on Mon Nov 13, 2023 4:13 pm

I think the data is being sent as unsigned with an offset of 0x8000. So you would just change your first pic, top example to set addr to -32768
David Ferguson
Veracity Racing Data
David Ferguson
Pro User
 
Posts: 1327
Joined: Fri Nov 07, 2008 2:45 am
Location: Paso Robles, California

Re: Issues with signed CAN message

Postby FrankL on Tue Nov 14, 2023 1:21 pm

Hello David,

Actually it might not be evident at first look, but t if you move the picture to the right using the scroll bar you will see the Comm setup in the dash.

The Comm setup for the red curve of the first graph shows no adder and is not signed. So I don't understand how the dash could log a negative CAN value. What confusing me the most, is that I displayed the channel on the dash and there is no negative number being displayed. The value on the dash stay around 32800, but the data logged varies between -327.. to +327... How can the value displayed on the dash be different than the logged data for the same channel?

The blue channel on the first graph is the same CAN address than the first red channel. The blue channel was logged on a second channel with a Comm setup without any offset, but with the signed box check. Scroll right for the CAN setup. There is not difference between both channels (signed or unsigned) on the logged file. When I display the blue channel on the dash display I see the negative number now.

Any idea what could cause that?

Frank
FrankL
 
Posts: 23
Joined: Sat Jan 16, 2016 5:39 am
Location: Québec, Canada

Re: Issues with signed CAN message

Postby adrian on Tue Nov 14, 2023 2:13 pm

All channels in the Dash are signed, when you set the length to '2' you are assigning a 16bit channel. As it is signed the full range is -32768 to 32767.

You can force it to allocate a 32bit channel (still signed) instead by changing the output length from 'Auto' to '4' and you will now log the full range of your unsigned 16bit channel.
adrian
MoTeC
 
Posts: 718
Joined: Mon Apr 13, 2015 5:16 pm


Return to Colour displays

Who is online

Users browsing this forum: No registered users and 3 guests