Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dala's Leaf buildthread (2015 Nissan Leaf)
I've been spending heaps of time getting to know the Nissan Leaf CAN system. Here is a compressed version, to quickly get you started with debugging the LEAF CAN system.

The LEAF uses standard 11-bit frames. Bus speed is 500kbps. There are 4x CAN buses available, CARcan, EVcan, QCcan and AVcan. We are only interested in the EVcan for correcting battery upgrades. Message speed in ms is 10/20/40/60/100/103/500/512 depending on which bus and message you look at. Stuff like amperages and voltages need to be communicated extremely quickly (10ms), but lower priority stuff like sending stuff to the instrument cluster is 50x slower (500ms)

The EVcan bus is extremely tolerant to errors. You can pause communication, and the car triggers limp mode, and on resuming communication the errors are cleared. Reverse engineering by simply modifying and seeing what happens is totally doable!

Lets take a closer look at frame 0x5BC on the EVcan, it contains much good stuff and is sent every 500ms from the LBC->VCM
0x5BC Frame, captured with CANrunner from my 24/30kWh bruteforce battery LBC
HEX: 0x17 c0 f0 64 c9 03 02 d0
DEC: 23 192 240 100 201 3 2 208
‭BIN: 00010111‬ 10000001 11110000 1100100 11001001 0011 ‭0010 11010000

The Battery Gauge display on the instrument cluster is powered by the GIDs signal (the first 10 bits of 0x5BC). The km estimate that the Guess-O-Meter spits out is also linked to the available GIDs. From example frame (BIN 1011110 = 94 DEC) for 94 GIDs available!

0x5BC bits 36-39 (the high nibble of the 5th byte) affects the battery charge gauge, lower numbers mean more bars. This section probably contains how much one GID is worth OR some degradation offset.

The battery capacity gauge (the bars outside the fuel gauge) is controlled by a muxed field, when 0x5BC bits 32-35 (ie the low nibble of the 5th byte) is 0x3, 0x5BC bits 16-19 (ie the low nibble of the 3rd byte) contains the capacity bars. Changing this value directly manipulates the number of bars displayed, the value on the can bus is literally the number of bars. From example frame (BIN 1100 = 12 DEC) 12 capacity bars available!
Korishan and Glubux like this post
The EVcan is available on the OBD2 port, on the nonstandard pins "CAN-L (12), CAN-H (13)"
Pinout of the car OBD2 connector:
[Image: connectorblue.GIF]

To capture the CAN data, I use a laptop with an USB Kvaser Memorator Professional
Interested to hear progress on your Leaf. I've got a 2011 Leaf (24kWH) with a replaced pack (module level swap, same BMS/case) and I plan to eventually add 9.8kWH of PHEV (+ a little extra 18650 to handle the worst case loads) Li-Ion to it using Muxsan's electronics. How did you end up buying just his CAN injector? Are you working with him officially in his other projects?
(08-29-2019, 08:58 PM)rev0 Wrote: Interested to hear progress on your Leaf. I've got a 2011 Leaf (24kWH) with a replaced pack (module level swap, same BMS/case) and I plan to eventually add 9.8kWH of PHEV (+ a little extra 18650 to handle the worst case loads) Li-Ion to it using Muxsan's electronics. How did you end up buying just his CAN injector? Are you working with him officially in his other projects?

Sounds like a nice project Smile

I am cooperating with Muxsan on a few things yeah. The CAN-bridge has some issues when installed in a e-NV200, so it might even need a hardware revision update. This is hindering the development, and is the main reason why the CAN-bridge is not yet available for sale.
I've got good progress on the instrumentation correction!

24kWh has ~280 gids full, 30kWh has ~360 gids full. After modifying the 0x5BC CAN message, and adding 70gids, the 24/30kWh bruteforce battery is atleast doing two things correctly now!

As you can see, it now reports remaining km even when all the charge bars have disappeared. Before it just went '---'! Also it doesn't trigger Low Battery Warning(LBW) anymore at 16%, it instead triggers close to actual LBW!

Now only two things left to fix, the dash SOC is still showing wrong % values. Also the chargebars disappear way too soon. But progress is progress! Big Grin
ilie, Glubux, lnxpro And 2 others like this post
I've been busy stomping bugs, here's a status update

Muxsan solved the CAN corruption issue that could occur every 6-12h. This was problematic, since it could cancel the charging session. Imagine setting your car to charge overnight and waking up to an almost empty battery! The fix supplied from Muxsan seems to work very well, so I am happy Smile

Another bug I noticed, was the Low Battery Warning popup. It triggers at the correct place (>30%SOC), but since the SOC is estimated with a voltage lookup table, it was not very stable. During heavy acceleration, it could trigger the LBW, and upon releasing the pedal, the LBW faded away.

To solve this, I now put in the lowest of effort, an average function!
[Image: PVce7di.png]

The code snippet at the top saves the battery voltage (once every 500ms), and makes an average once 10 samples have been read. This should remove the heavy swings in the SOC-estimation. Let's see if I need something more elegant, but I like to keep things simple.

Speaking of simple, I just got a shipment of EVs Enhanced HV Battery Translator. These can do clean upgrades, for swapping in 30kWh packs into 2013-2015 Nissan Leafs. Essentially making my bruteforce method obsolete for this vintage of Leafs (and that is a really good thing!).
[Image: 6rPM5Ll.jpg]

I've been putting off touching the 40kWh pack, since Muxsan has gotten 40kWh packs to natively boot in a 24kWh Leaf. If it were possible to do a clean 40kWh swap with only the CAN-bridge, I would much prefer that compared to another 12h+ session of bruteforcing an upgrade.
Korishan and RikH like this post

Who read this thread?
100 User(s) read this thread:
daromer (08-03-2019, 09:32 AM), Sean (09-13-2019, 06:15 PM), mike (06-05-2019, 06:10 PM), Glubux (09-01-2019, 05:19 PM), nexsuperne101 (05-21-2019, 09:18 AM), Korishan (09-13-2019, 08:04 PM), A + A (08-30-2019, 09:16 PM), PAF (09-01-2019, 04:46 PM), Franky Beuselinck (08-30-2019, 07:58 AM), jdeadman (09-13-2019, 07:17 PM), wim (08-29-2019, 09:14 PM), 1958 greyhound (01-13-2019, 08:56 PM), watts-on (09-16-2019, 08:58 AM), jesusangel (01-03-2019, 01:12 PM), Hanssing (08-19-2019, 06:01 AM), Stefaan De Ridder (08-25-2019, 01:46 PM), BlueSwordM (01-03-2019, 10:13 PM), Dennis Van Hoek (03-15-2019, 01:42 PM), lnxpro (08-30-2019, 06:46 PM), netmonk (11-20-2018, 03:39 PM), Mazlem (06-14-2019, 11:50 PM), ivnz (01-11-2019, 05:57 AM), Geek (09-16-2019, 01:54 AM), SWEwall (06-05-2019, 09:54 PM), mr_hypno (11-09-2018, 10:34 PM), floydR (07-04-2019, 09:14 PM), Menno (09-16-2019, 01:15 AM), DarkRaven (01-08-2019, 08:15 PM), DCkiwi (07-17-2019, 08:11 AM), slimf (09-14-2019, 02:45 AM), Oz18650 (08-26-2019, 02:48 AM), rev0 (09-13-2019, 07:12 PM), CarelHassink (01-09-2019, 06:59 AM), bogptrsn (07-28-2019, 11:18 AM), garolittle (05-20-2019, 03:09 PM), Jensk (09-15-2019, 06:17 PM), Filip (02-11-2019, 06:57 PM), bigblue (08-31-2019, 12:02 PM), Charly144 (04-30-2019, 08:03 AM), BaronVonChickenPants (11-05-2018, 08:16 AM), sturgeo (08-03-2019, 08:26 AM), spinningmagnets (02-10-2019, 02:12 PM), jm1 (12-24-2018, 11:38 PM), Jason Morris (11-09-2018, 09:23 PM), brwainer (11-08-2018, 05:07 AM), HughF (09-03-2019, 11:39 AM), gregoinc (12-20-2018, 08:02 AM), Drokz (Yesterday, 07:59 PM), EGOksy (05-18-2019, 09:28 PM), gpn (11-06-2018, 06:21 AM), Jimbob01 (11-27-2018, 11:13 PM), Paul (11-23-2018, 05:34 PM), Dala (09-19-2019, 12:47 PM), Doyle (01-04-2019, 12:22 AM), Redpacket (02-10-2019, 09:17 AM), Goldy (12-20-2018, 11:45 PM), completelycharged (02-19-2019, 09:30 PM), Zvonko000 (02-18-2019, 08:58 PM), Oliman (07-13-2019, 01:53 AM), micsa84 (11-06-2018, 04:45 PM), farmerjohn (07-20-2019, 09:27 PM), choncy12 (08-14-2019, 08:54 PM), JDish (11-29-2018, 10:44 AM), Sholphin02 (07-09-2019, 03:05 AM), Walde (09-01-2019, 09:13 PM), Riplash (08-24-2019, 03:42 PM), djotter (01-28-2019, 11:37 PM), ungp (01-31-2019, 10:20 PM), w0067814 (05-23-2019, 08:29 PM), Dragora (11-17-2018, 06:33 AM), Buzz0515 (11-13-2018, 05:55 PM), chuckp (08-26-2019, 12:47 AM), Electronic Matrix (12-01-2018, 11:11 AM), Powermad00 (02-16-2019, 10:49 AM), emuland-metroman (11-09-2018, 07:07 AM), hazSolar (01-07-2019, 03:19 AM), Robrecht (08-23-2019, 07:00 PM), hermitdave (11-22-2018, 02:22 PM), lordxenu (01-08-2019, 02:30 PM), Beholder (01-04-2019, 06:46 AM), jaeger-audiodesign (07-30-2019, 08:17 PM), Leipi35 (01-19-2019, 10:54 PM), Ronald Hyde (01-28-2019, 10:10 PM), Niemma (01-15-2019, 12:22 AM), glyndwr1998 (04-15-2019, 11:08 AM), Wolf (08-26-2019, 11:42 AM), Bastler_Ro (07-09-2019, 06:54 PM), 5buBZMKeJZgapTGsbGzKf (09-08-2019, 12:08 PM), Scottietheyoung (01-27-2019, 09:54 PM), Wardy (02-19-2019, 06:28 PM), collinkoolen999 (11-21-2018, 08:18 AM), camthecam (06-21-2019, 12:16 PM), ohv_ (01-14-2019, 09:25 PM), Generic (06-14-2019, 11:23 PM), Solardad (07-28-2019, 05:07 PM), Melan (12-02-2018, 12:46 PM), Speicher (01-09-2019, 03:45 PM), stevelectric (09-04-2019, 08:48 AM), Bdaearth (11-09-2018, 10:50 AM), BigDav (02-19-2019, 09:19 PM)

Forum Jump:

Users browsing this thread: 1 Guest(s)