Steering Angle CANBUS

Hi I am trying to figure out how to extract the steering angle from the following two-byte sequence, where:

Full Left – B0=1 B1=3D

Centre – B0=0 B1=0

Full Right – B0=0E B1=CE

Any suggestions most welcome.

Center is quite obvious 0
Full Left is 0x3D01 which is 15617 decimal
Full Right is 0xCE0E which is -12786 as signed decimal

CAN XML supports attribute signed=“true” to interpret value as signed.

@realdashdev I am struggling to come up with the xml for this frame 0x25 entry, can you kindly advise

My best guess with this very limited info would be:

<frame id="0x25" endianess="big">
  <value targetId="229" offset="0" length="2" signed="true" conversion="V/100*2"></value> <!-- Steering wheel angle -->
</frame>

Don’t know amount of degrees your steering wheel on full turns, but you can play with conversion to get it match actual degrees.

value targetId=“229” startbit=“3” bitcount=“12” units=“deg” endianess=“big” signed=“true” rangeMin=“-500” rangeMax=“500” conversion=“V*1.5”></value

I ended up honing in on this 2-bit value, which at centre is 0, and turning left increments positively from 1, but turning right decrements negatively from 767, not sure how I can get this to show as -1 onwards?

What was wrong with my proposal?

Yours does exactly the same, except it increments from 1 turning left and decrements from 82 turning right. I believe only 12-bits are used, hence mine eliminated the unused bits.

Discarding first two bits only degrades the precision of the value. I think you are in wrong track.

I am eliminating 4 bits, which if I look at some of the Toyota DBC’s I have found suggest these bits are used for something else, SSA below is the 12 bit steering angle

BO_ 37 STR1S01: 8 CGW
SG_ STS3 : 7|1@0+ (1,0) [0|0] “” AFS,BSR,DS1,FCM,MAV
SG_ STS2 : 6|1@0+ (1,0) [0|0] “” AFS,DS1,FCM,KSS,MAV,SCS
SG_ STS1 : 5|1@0+ (1,0) [0|0] “” AFS,BSR,DS1,FCM,KSS,MAV,SCS
SG_ STS0 : 4|1@0+ (1,0) [0|0] “” Vector__XXX
SG_ SSA : 3|12@0- (1.5,0) [0|0] “deg” AFS,BSR,DS1,FCM,KSS,MAV,SCS

I don’t think signed=“true” does anything when you are working on individual bits. You’d be better to read the full 2 bytes as signed, then mask and bitshift as needed on ‘conversion’.

value targetId=“229” offset=“0” length=“2” signed=“true” conversion=“V<<2”

I believe this would in effect centre the 12-bit value within the 2 bytes, but not sure how to mask?

As I understand you’d like to lose 3 least significant bits, so conversion would be:

conversion="(V>>3) &amp; 0xfff"

bitpos

I am attaching screenshot of bits needed, this is the 4 most significant bits I need to mask?

If it really is like that, you need to take second byte and bitwise or the 4 LSB from the first byte:

conversion="B1 | ((B0 &amp; 0xf) << 8)"

Hello. Help with XML.

What kind of help would you require?

Hello. Help with the XML setup . Code from kanbus to come 00000191: 02 00 00 00 00 00 00 00. The panel does not see the signal .

<frame id="0xF191">	 
	<value targetId="93"  offset="0" length="1" conversion="V" ></value> <!-- Button 1 Dummy 01 -->
	<value targetId="94"  offset="1" length="1" conversion="V" ></value> <!-- Button 2 Dummy 02 -->
	<value name="OilpresU" offset="3" length="1" conversion="V" ></value>
	<value name="Brake_Fluid" offset="2" length="1" conversion="V" ></value>
	<value targetId="178" offset="2" length="1" conversion="V" ></value> <!-- Brake Fluid Level -->
	<value name="FrontFogLightU" offset="4" length="1" conversion="v" ></value>
	<value name="GasBenzU" offset="5" length="1" conversion="v" ></value>
	<value name="WaterLevelU" offset="4" length="1" conversion="v" ></value>
	<value name="CNT" offset="7" length="1" conversion="v" ></value>
 </frame>

line. WetetLeveIU , which is needed.

Could be the F in the frame id? Surely this should just be “0x191”