collink
Posts: 5
Joined: Sun Oct 12, 2014 11:19 am
Delivery Date: 12 Oct 2014

Re: Anybody mess with the CAN Commanded Torque Message ID 0x

Sun Oct 12, 2014 11:37 am

I've written a quick and dirty C# app that can correctly implement the algorithm that was posted in this forum and in the recently posted spreadsheet. It can be downloaded at: http://www.kkmfg.com/CRC_Nissan.zip there is an executable in there as well as the source code.

I will upload it to my github account as well. I'm Collin80 on github: https://github.com/collin80 I don' t have a Nissan Leaf but I am heavily into canbus and reverse engineering so there should still be relevant stuff there.

You can enter in the CRC polynomial and the first 7 bytes and it will return the correct CRC byte. I have tested this on the examples from the spreadsheet.

collink
Posts: 5
Joined: Sun Oct 12, 2014 11:19 am
Delivery Date: 12 Oct 2014

Re: Anybody mess with the CAN Commanded Torque Message ID 0x

Sun Nov 02, 2014 7:50 pm

JeremyW wrote:Weber and all, you might wanna take a look at EV can messages 1DB, 1DC, and 55B to see if 0x85 works for those too. The last byte looks like a CRC (values all over the place).

CRC stuff isn't clicking for me yet. I'll have to read that paper for like the 3rd or 4th time. :?


The posted security byte algorithm does in fact work for very many of the other frames. I think I only found a couple that didn't match and they probably were non-command frames that they didn't bother to secure.

1DA works
1DB works
1DC works
11A works
1D4 works
1F2 does not check out
284 does not check out
55B works

So, mostly things that work out show up as having a possible CRC in the last byte in the spreadsheet. The odd one out is 1DA which someone guessed to have phase current in that byte. It doesn't - it's a security byte.

User avatar
JeremyW
Posts: 1540
Joined: Sun Nov 13, 2011 12:53 am
Delivery Date: 23 Jun 2012
Leaf Number: 19136
Location: San Gabriel, CA

Re: Anybody mess with the CAN Commanded Torque Message ID 0x

Sun Nov 02, 2014 9:03 pm

Hmm. I was confident that 1DA byte 7 had the phase currents with the mux on byte 6. The signals were periodic in nature and were steady when stationary.

11F is VCM state and has at least command charge power on it (for 2012's). Considering pumping in extra amps doesn't seem to bother things, not surprised this isn't secured.

284 is a relay via the VCM from the ABS module (which handles wheel speeds). It's for the shift selector so that it can decide whether to allow parking or change of direction. It would be really bad to fake this and well shift into reverse or park at speed. Not sure if everything else would comply or not. Wouldn't test it! :shock:
Former 2012 SL leasee 6/23/12 - 9/23/15
Now driving Honda Fit EV, License plate: CHADEMO
2000 Honda Insight for long trips

kubel
Posts: 1609
Joined: Mon Feb 13, 2012 11:38 am
Leaf Number: 19628
Location: Southeast Michigan

Re: Anybody mess with the CAN Commanded Torque Message ID 0x

Tue Nov 11, 2014 8:15 am

camasleaf wrote:If we have enough information to make an inverter go to regen mode, then one could buy a used Leaf motor and inverter drive it with an ICE engine to quick charge at up to 30kW.


Why do that when you can just bolt it to the back wheels of a LEAF and then drive infinitely?!!!

::insert troll physics image of your choice::
2012 Nissan LEAF SV
20% degradation in 42k miles
Leased 5-17-2012, Returned 1-15-2016


2017 Chevy Volt LT
Siren Red Tintcoat
Leased 10-21-2016

GregH
Posts: 860
Joined: Fri Jul 01, 2011 4:16 pm
Delivery Date: 13 Jun 2011
Leaf Number: 26967
Location: Irvine, CA

Re: Anybody mess with the CAN Commanded Torque Message ID 0x

Wed Nov 12, 2014 6:25 pm

If you guys get this working I have another request... Aside from upping the off-the-line torque, I'd like to have the B-mode feel of 2011/12 Eco mode without making the accelerator sluggish. Ie, I'd like to UN-map the the eco sluggishness accelerator pedal remapping while keeping the extra regen!
'17 blue Volt Premier w/ACC
'12 SL black Leaf
'11 SL blue Leaf
RAV4-EV 2002-2005
Gen1 & Gen2 EV1 1997-2003
PV 2.4Kw, 10kWh lithium battery SCE TOU-DA

caederus
Posts: 8
Joined: Sun Mar 20, 2016 9:34 am
Delivery Date: 01 Mar 2016

CAN packets with checksums

Thu Jun 16, 2016 9:26 am

I checked all the packets I have logged on EV-CAN to identify valid 0x85 checksum bytes and agree that Collin has already found all the 8-byte ones (11A 1D4 1DA 1DB 1DC 55B), but there is also one shorter packet, 0x50C of length 6, which also seem to consistently have a valid checksum in the last byte. I don't have any idea what this message is for, and it's unexcitingly repetitive: byte 3 cycles 0, 1, 2, 3 every 4 packets and byte 4 toggles between 5D and B2 every 5 packets (almost inverted bits %01011101 and %10110010, except for bit 4 which is always 1).

I also spotted one packet of length 7 on the CAR-CAN which has a valid checksum in the last byte: 0x1CB - which makes sense if it is indeed commanded brake/regen as TickTock's spreadsheet suggests.

retepsnikrep
Posts: 2
Joined: Sun Jan 14, 2018 11:55 am
Delivery Date: 14 Jan 2018

Re: Anybody mess with the CAN Commanded Torque Message ID 0x1D4?

Sun Jan 14, 2018 12:14 pm

Sorry to resurrect this thread but I'm interested in the leaf CANBUS crc and security type code formulae.
I'm doing a similar project on another system and some sample repeating CANBUS data is below.

I'm struggling to work out how the two bytes at the end of the packet are generated.
I assume the last is a CRC and the penultimate one some sort of security check as it is may not be data related.
Any leads would be appreciated. Sadly polynomials is not my strong point.

ID,D1,D2,D3,D4,D5,D6,D7,D8
203,0,0,0,0,0,0,0,9A
203,0,0,0,0,0,0,20,2F
203,0,0,0,0,0,0,1D,7E
203,0,0,0,0,0,0,0,8B
203,0,0,0,0,0,0,20,10
203,0,0,0,0,0,0,1D,6F
203,0,0,0,0,0,0,0,B8
203,0,0,0,0,0,0,20,1
203,0,0,0,0,0,0,1D,50
203,0,0,0,0,0,0,0,A9
203,0,0,0,0,0,0,20,3E
203,0,0,0,0,0,0,1D,41
203,0,0,0,0,0,0,0,9A
203,0,0,0,0,0,0,20,2F
203,0,0,0,0,0,0,1D,7E
203,0,0,0,0,0,0,0,8B
203,0,0,0,0,0,0,20,10
203,0,0,0,0,0,0,1D,6F
203,0,0,0,0,0,0,0,B8
203,0,0,0,0,0,0,20,1
203,0,0,0,0,0,0,1D,50
203,0,0,0,0,0,0,0,A9
203,0,0,0,0,0,0,20,3E
203,0,0,0,0,0,0,1D,41
203,0,0,0,0,0,0,0,9A
203,0,0,0,0,0,0,20,2F
203,0,0,0,0,0,0,1D,7E
203,0,0,0,0,0,0,0,8B
203,0,0,0,0,0,0,20,10
203,0,0,0,0,0,0,1D,6F
203,0,0,0,0,0,0,0,B8
203,0,0,0,0,0,0,20,1
203,0,0,0,0,0,0,1D,50
203,0,0,0,0,0,0,0,A9
203,0,0,0,0,0,0,20,3E
203,0,0,0,0,0,0,1D,41
203,0,0,0,0,0,0,0,9A
203,0,0,0,0,0,0,20,2F
203,0,0,0,0,0,0,1D,7E
203,0,0,0,0,0,0,0,8B
203,0,0,0,0,0,0,20,10

and a bit more with some data.

203,24,62,46,24,72,47,20,3C
203,24,92,46,24,72,47,2B,4D
203,24,A2,4B,0,0,0,0,99
203,24,62,46,24,72,46,20,2E
203,24,92,46,24,72,46,2B,7B
203,24,92,4D,0,0,0,0,89
203,24,42,44,24,72,44,20,15
203,24,92,44,24,72,4A,2B,6A
203,24,C2,4C,0,0,0,0,B4
203,24,22,42,24,62,3F,20,1
203,24,92,42,24,62,4F,2B,59
203,25,32,4B,0,0,0,0,AE

weber
Posts: 6
Joined: Mon Aug 04, 2014 7:33 pm
Delivery Date: 04 Sep 2013

Re: Anybody mess with the CAN Commanded Torque Message ID 0x1D4?

Sun Jan 14, 2018 3:57 pm

Hi retepsnikrep. The fact that the last 16 bit number cycles through 12 different values while the preceding 6 bytes remain all zero, means that it is not simply a CRC. Nor can the last 8 bit number be a CRC since we see four different values when the 7 preceding bytes are all zero. So I'm sorry, I don't know what's going on there.

retepsnikrep
Posts: 2
Joined: Sun Jan 14, 2018 11:55 am
Delivery Date: 14 Jan 2018

Re: Anybody mess with the CAN Commanded Torque Message ID 0x1D4?

Tue Jan 16, 2018 1:48 pm

Ok a slightly different problem.
The canbus sends me the following hex data from a battery management system.

Just to summarise the 12 bit hex voltage data obtained from the 10 cell Lithium BMS. I have grouped it as required. The test voltages I used are not 100% accurate but should be pretty near the number quoted below. e.g. 4v quoted could be 3.95 or 4.05 etc etc

4v per cell
9DD,9E2,9DF,9E2
9E4,9E3,9E5,9E7
9F0,9EA

3v per cell
756,75C,75A,75C
75C,75E,760,761
76B,764,

2v per cell
4D2,4D2,4D2,4D4
4D7,4D2,4D4,4D3
4D7,4D6

1v per cell
246 246 247 246
249 246 247 246
249 24D

0V = 0v per cell (Some leakage and noise here)
0D0,0D4,0C1,0E2
0DE,0E6,0FC,0E3
0C5,0E7

So the question.. How do we get the cell voltage from the above hex data?
Formulae..

weber
Posts: 6
Joined: Mon Aug 04, 2014 7:33 pm
Delivery Date: 04 Sep 2013

Re: Anybody mess with the CAN Commanded Torque Message ID 0x1D4?

Tue Jan 16, 2018 2:38 pm

Ignore the zero volt readings. It looks like it can't measure anything below about 0.4. V. Average the readings for each of the other voltages and fit a straight line to it. In decimal, it looks like approximately voltage = (reading + 64) / 648.

Return to “Engineering”