Controlling Leaf inverter via CAN-bus

Nissan Leaf/e-NV200 drive stack topics
Post Reply
User avatar
bexander
Posts: 528
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden

Controlling Leaf inverter via CAN-bus

Post by bexander »

Trying to control the leaf inverter (Gen2 (EM57, 80kW)) via CAN. Are using celeron55 information,
http://productions.8dromeda.net/c55-lea ... tocol.html
as well as Damiens SW for Leaf Inverter Controller,
https://github.com/damienmaguire/Nissan ... Controller
and Stm32 VCU,
https://github.com/damienmaguire/Stm32-vcu.

My question is how do I implement reverse?
Only changing byte0 in 0x11A from 4E to 2E is not enough.
In Damiens sw it looks like he is always using 0x4E and only changing the sign of the requested torque?
Do I need to change byte5 of 0x1D4 to 0x42 (0x44) as well when selecting gear?
User avatar
johu
Site Admin
Posts: 2918
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Contact:

Re: Controlling Leaf inverter via CAN-bus

Post by johu »

Happened to work on that part ;) yes just reverse the sign. Same a regen. If you don't do anything about it, when you regen to a stop it will then take off in reverse :D
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
arber333
Posts: 1938
Joined: Mon Dec 24, 2018 1:37 pm
Location: Slovenia
Contact:

Re: Controlling Leaf inverter via CAN-bus

Post by arber333 »

johu wrote: Tue Nov 23, 2021 8:02 pm Happened to work on that part ;) yes just reverse the sign. Same a regen. If you don't do anything about it, when you regen to a stop it will then take off in reverse :D
You should listen to inverter report for RPM. When it gets close to 60RPM or similar your torque command then should go to 0 or switch to the other side. Regen should also be 0 there. You also need to have a loop to ignore reverse command in case RPM is still above 60RPM.
User avatar
johu
Site Admin
Posts: 2918
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Contact:

Re: Controlling Leaf inverter via CAN-bus

Post by johu »

yes, yes, that's what we did in Zombieverter. Much like in the openinverter-inverter. It ramps down towards 0.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 528
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden

Re: Controlling Leaf inverter via CAN-bus

Post by bexander »

Thank you gentlemen!
Summary:
Keep 0x4E all the time, and only change sign on torque command for reverse.
Only allow "gear change" below 60rpm.
Stop regen below 60rpm.
User avatar
johu
Site Admin
Posts: 2918
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Contact:

Re: Controlling Leaf inverter via CAN-bus

Post by johu »

That'll oscillate. Check here
https://github.com/damienmaguire/Stm32- ... u.cpp#L396
and here
https://github.com/damienmaguire/Stm32- ... e.cpp#L252

@Damien: didn't you modify that last part?
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
User avatar
bexander
Posts: 528
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden

Re: Controlling Leaf inverter via CAN-bus

Post by bexander »

Thats great! I haven't started with the regen part yet as I have an issue when I'm in reverse (negative torque request) and at standstill (or very low speed). I can't get much torque. I only can get the inverter to pull 0,5A from the battery (360V) no matter how much torque I request. When in forward (positive torque request), no problem, I get the torque I command.
Have you experienced anything similar to this?

EDIT: Found and solved my issue by sending the correct byte0 and byte1 for ID 0x1D4, both 0x6E and not 0x7F & 0x07...
User avatar
Jack Bauer
Posts: 3065
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Contact:

Re: Controlling Leaf inverter via CAN-bus

Post by Jack Bauer »

Yeah regen cuttoff rpm is raised in proportion to the % of regen selected. Works great.
I'm going to need a hacksaw
User avatar
bexander
Posts: 528
Joined: Tue Jun 16, 2020 6:00 pm
Location: Gothenburg, Sweden

Re: Controlling Leaf inverter via CAN-bus

Post by bexander »

Got it working, both acc and regen in both directions.
Thank you all for great input!
Post Reply