Sevcon Gen4 CAN messages

Electric Motors and Controllers
Post Reply
Hube-   1 mW

1 mW
Posts: 14
Joined: Jul 22 2014 12:58am

Sevcon Gen4 CAN messages

Post by Hube- » Aug 11 2018 3:09am

I was planning to build a custom dashboard for the Sevcon Gen4 Size6 controller by reading the CAN messages. However, I don't have access to the DVT software and therefore can't customize messages. I am stuck with the settings I have. Is there any way to decipher these frames? If not, I have to resolve with a less elegant solution.

These are taken from the bench test. No throttle or anything. I am mostly interested on RPM, Power, Current and Voltage.

"ID (hex)";"DLC";"Data (hex)"
" 80";"0";""
"286";"8";"00 00 00 00 12 00 FE FF"
"339";"8";"00 00 00 00 00 00 9A 03"
"173";"8";"D4 7D 2A 01 25 02 24 00"
"156";"7";"FD 05 21 00 00 00 00"
"279";"8";"00 00 00 00 00 00 00 00"
" 80";"0"
"286";"8";"00 00 00 00 FC FF F8 FF"
"339";"8";"00 00 00 00 00 00 9A 03";
"173";"8";"D4 7D 2A 01 25 02 24 00"
"156";"7";"FD 05 21 00 00 00 00"
"279";"8";"00 00 00 00 00 00 00 00"

BR

User avatar
amberwolf   100 GW

100 GW
Posts: 30325
Joined: Aug 17 2009 6:43am
Location: Phoenix, AZ, USA, Earth, Sol, Local Bubble, Orion Arm, Milky Way, Local Group
Contact:

Re: Sevcon Gen4 CAN messages

Post by amberwolf » Aug 11 2018 1:09pm

Well, if they use straightforward conversion from hex to decimal for the values, you can put hte driven wheel off ground, then measure various things externally, and convert the hex data to see if any of the values closely match what you know a particular thing should be.

RPM and voltage are the easiest; current depends on if they are meauring battery or phase. Battery is easy to measure externally; phase less so.

User avatar
Bernel   100 W

100 W
Posts: 173
Joined: Feb 03 2013 3:33pm
Location: Peterborough, England

Re: Sevcon Gen4 CAN messages

Post by Bernel » Aug 13 2018 5:43pm

I am trying to do the same, use the CAN data to drive a display from my Size 6. I haven’t been able to initialise CAN yet so work in progress. I may be able to help with the CAN data you have posted. I will check those values in my DVT tomorrow and see if I can decipher them.

Bernel

User avatar
Bernel   100 W

100 W
Posts: 173
Joined: Feb 03 2013 3:33pm
Location: Peterborough, England

Re: Sevcon Gen4 CAN messages

Post by Bernel » Aug 14 2018 3:54pm

Hi Hube,
This is what I have found out so far.
80 0 is a sync message
286 8 is the second transmitted PDO
339 8 is the second received PDO
73 8 is a time stamp
56 7 is a time stamp
279 8 is the first received PDO

The first column is the COB-ID, the second column is the data length. I have not worked out the hex values yet but they are data.

Can you enlighten us all on what you used to capture this data?

kiwifiat   100 W

100 W
Posts: 209
Joined: Mar 16 2013 5:49pm
Location: Vancouver, Canada

Re: Sevcon Gen4 CAN messages

Post by kiwifiat » Aug 14 2018 7:08pm

Take a look at the opensource OVMS project for the Renault Twizy which uses a GEN4 sevcon and allows both monitoring of system parameters and changing of tuning profiles. Also have a look at the Sevcon CANopen Master Object Dictionary spreadsheet which defines the data types for every object and that will save you having to manually decode the data.
“You never know if quotes on the internet are genuine.” - Abraham Lincoln

Hube-   1 mW

1 mW
Posts: 14
Joined: Jul 22 2014 12:58am

Re: Sevcon Gen4 CAN messages

Post by Hube- » Aug 15 2018 11:33am

Thank you! So I suppose all the interesting data is in the PDOs. I used the IXXAT CAN-USB and IXXAT canAnalyser3 Mini software to read the messages. I checked the interesting values from the Sevcon CANopen Master Object Dictionary spreadsheet but not sure how could I use these. At least there are scaling factors for each value. Not sure if any of those are included in my CAN setup.
Attachments
data_snippet.JPG

User avatar
Bernel   100 W

100 W
Posts: 173
Joined: Feb 03 2013 3:33pm
Location: Peterborough, England

Re: Sevcon Gen4 CAN messages

Post by Bernel » Sep 05 2018 4:31pm

The addresses are the COB ID’s of each TPDO, each PDO contains objects such as battery voltage, motor current etc. You will need to know what object(s) are in each PDO then you can work out the decimal values from the hex values and apply any scaling to get readable data.

Each TPDO can hold 8 bytes of data.


Bernel

vinshou   1 µW

1 µW
Posts: 1
Joined: Feb 12 2020 9:50am

Re: Sevcon Gen4 CAN messages

Post by vinshou » Feb 12 2020 9:59am

hello all

I'm trying to decode raws frames canbus from a Sevcon Gen4 and I'm lost, anyone can help me pleas ?

Below, a part of frames captured:

can0 080 [0]
can0 120 [8] 00 00 00 00 02 00 01 00
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 03 00 F8 FF
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 09 00 08 00
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 FB FF FB FF
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 07 00 11 00
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F8 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 01 00 0C 00
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 03 00 F8 FF
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]
can0 120 [8] 00 00 00 00 FD FF 03 00
can0 326 [8] 00 00 00 00 00 00 8D 06
can0 303 [6] D4 7D 7C 00 F6 00
can0 200 [8] F9 02 00 00 00 00 00 00
can0 397 [6] 00 00 00 00 00 00
can0 080 [0]

I have the Objects dictionnary but I don't know how to convert frames to match with index and subindex. :confused:

Please help me

Thank you

User avatar
OpenGB4   1 µW

1 µW
Posts: 4
Joined: Sep 08 2019 10:28pm
Location: Green Bay, WI
Contact:

Re: Sevcon Gen4 CAN messages

Post by OpenGB4 » Feb 26 2020 7:01am

Hello vinshou - have you made any progress on translating TPDO into correct parameters?

Hube-   1 mW

1 mW
Posts: 14
Joined: Jul 22 2014 12:58am

Re: Sevcon Gen4 CAN messages

Post by Hube- » Mar 03 2020 11:44am

Hi,

Here is my ESP32 code for the CAN part. Hope this helps. I have no time to translate everything, and also I don't remember any more how all this works :P. I'm not professional programmer. If I remember correctly, I had the IXXAT USB-CAN dongle which I used to translate what bit meant what.


void canbus(void * pvParameters) { // Core 0 loop
for (;;) {
CAN_frame_t rx_frame;
if (xQueueReceive(CAN_cfg.rx_queue, &rx_frame, 3 * portTICK_PERIOD_MS) == pdTRUE) {

if (rx_frame.MsgID == 0x80) {
}

if (rx_frame.MsgID == 0x154) {
}

if (rx_frame.MsgID == 0x128) {
}

if (rx_frame.MsgID == 0x297) {
//ptc = (rx_frame.data.u8[7] << 8)+ rx_frame.data.u8[6]; // motor temperature
ptc = rx_frame.data.u8[7] << 8;
ptc = rx_frame.data.u8[6] | ptc;

}

if (rx_frame.MsgID == 0x301) {
battery_voltage_test = (rx_frame.data.u8[1] * 255 + rx_frame.data.u8[0]) * 0.0625;
if (battery_voltage_test > 150){
battery_voltage = 0;
}
else{
battery_voltage = battery_voltage_test;
}

heatsink = rx_frame.data.u8[2];

//battery_current_test = ((rx_frame.data.u8[4]*255 << 8) + rx_frame.data.u8[3])*0.0625;
battery_current_test = (rx_frame.data.u8[4]*255 + rx_frame.data.u8[3])*0.0625;
if (battery_current_test > 1500){
battery_current = 0;
}
else{
battery_current = battery_current_test;
}

}

if (rx_frame.MsgID == 0x298) {
rpm_test = (rx_frame.data.u8[7] << 8) + (rx_frame.data.u8[6] << 8) + (rx_frame.data.u8[5] << 8) + rx_frame.data.u8[4];

if (rpm_test > 10000){
rpm = 0;
}
else{
rpm = rpm_test;
}

v = radius_of_wheel * rpm / gearing;
v = round(v);

}

/*
Serial.print(millis());
Serial.print(",");
Serial.print(rx_frame.MsgID, HEX);
Serial.print(",");
Serial.print(rx_frame.FIR.B.DLC, HEX);

for(int i = 0; i < 8; i++){
Serial.print(",");
Serial.print(rx_frame.data.u8, HEX);
}
Serial.println();
*/
}
}

Post Reply