Hi,
I recently added a ECUMaster Wheel Panel, its powered by the Can Switch Board V3. I’m trying to configure my XML file to read the canbus output from the ECUMaster switchboard, but after spending hours I just can’t get it to work, so hoping you can point me where I’m going wrong here:
Firstly here is the Canbus output from the Can Switch Board V3.
Source: https://www.ecumaster.com/files/devices/switchboard/switchboardManual.pdf
- The BaseID for my setup is 643.
- I’m specifically trying to get the values from R1, R2, R3 and R4. (Then I’ll move on to SW_MASK)
In Canbus monitor I can see the values changing as I change the rotary pots on the steering wheel.
I’ve tried a few different configurations, but none have worked:
<frame id="0x645" endianess="little"><!--Frame19 enum="7:1,6:2,5:3,4:4,3:5,2:6,1:7,0:8"-->
<value name="ECMR1" offset="0" startbit="0" bitcount="1" units="bit"></value><!--ECU MASTER BLACK ROTARY-->
<value name="ECMR2" offset="1" startbit="1" bitcount="1" units="bit" conversion="V"></value><!--ECU MASTER GREEN ROTARY-->
<value name="ECMR3" offset="2" startbit="2" bitcount="1" enum="7:1,6:2,5:3,4:4,3:5,2:6,1:7,0:8"></value><!--ECU MASTER RED ROTARY-->
<value name="ECMR4" offset="3" startbit="3" bitcount="1"></value><!--ECU MASTER BLUE ROTARY-->
</frame>
The thing to note is the values are in reverse, hence the ENUM above.
Rotary Pot = 1, Value is shown as 7 on the Can Monitor
Rotary Pot = 2, Value is shown as 6 on the Can Monitor
etc.
Can you point me in the right direction?
How about this one:
<frame id="0x645">
<value name="EcuMaster: ECMR1" offset="0" length="1" conversion="V>>4">
</value>
<value name="EcuMaster: ECMR2" offset="0" length="1" conversion="V & 15">
</value>
<value name="EcuMaster: ECMR3" offset="1" length="1" conversion="V>>4">
</value>
<value name="EcuMaster: ECMR4" offset="1" length="1" conversion="V & 15">
</value>
</frame>
That worked perfectly. Thank you! Can I buy you a beer? I don’t even understand how those formulas work, but they do!
1 Like
The data for the rotary switches are in first and second byte, hence offset=“0”, offset=“1” and length=“1”.
In these cases, I like to work on single byte instead of using startbit and bitcount. So first value takes the first byte from the CAN frame and shifts its bits left by four (V >> 4). Resulting value is the 4 bit value from top 4 bits, discarding the lowest 4 bits.
Second value is read from the same byte, but instead of shifting the bits, the value is masked with bitwise AND operation so only lowest 4 bits are used for the value. Conversion attribute uses &
instead of just &, because the ‘&’ character is reserved in XML specs and must be enclosed in amp.
Third and fourth value are handled the same, only with offset=“1” to work on a second byte on frame data.
One problem you had on your XML was the units=“bit”. If value is marked to be a bit, its value is interpreted as 0 or 1, so it never actually attempts to read all bits from the data. Marking a value as bit can be handy as only the lowest bit is read for the value so conversion will be simpler in many cases.
1 Like
mocking up switchboard v3 too, but trying to make xml for switches? when I put ground to switch1 channel I get “01”, when grounding switch2 - “02”, but when grounding switch1 and switch2 at the same time - “03”, is that ok? will the RD handle the switch states at the same time?
<frame id="0x642" endianess="little">
<value name="CSB_SW1" offset="0" startbit="0" bitcount="1" units="bit"></value><!--switch1-->
<value name="CSB_SW2" offset="1" startbit="1" bitcount="1" units="bit"></value><!--switch4-->
<value name="CSB_SW3" offset="2" startbit="2" bitcount="1" units="bit"></value><!--switch3-->
<value name="CSB_SW4" offset="3" startbit="3" bitcount="1" units="bit"></value><!--switch4-->
</frame>
will this work?
It won’t as you are increasing offset. Offset means which byte on CAN frame to work on. Status of those switches are on same byte. Same thing as previous messages on this thread, I like to do that differently by using whole byte and bitshifts:
<value name="CSB_SW1" offset="0" units="bit"></value>
<value name="CSB_SW2" offset="0" units="bit" conversion="V>>1"></value>
<value name="CSB_SW3" offset="0" units="bit" conversion="V>>2"></value>
<value name="CSB_SW4" offset="0" units="bit" conversion="V>>3"></value>