Page 1 of 1

Controlling Leaf inverter via CAN-bus

Posted: Tue Nov 23, 2021 6:07 am
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?

Re: Controlling Leaf inverter via CAN-bus

Posted: Tue Nov 23, 2021 8:02 pm
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

Re: Controlling Leaf inverter via CAN-bus

Posted: Wed Nov 24, 2021 7:50 am
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.

Re: Controlling Leaf inverter via CAN-bus

Posted: Wed Nov 24, 2021 10:13 am
by johu
yes, yes, that's what we did in Zombieverter. Much like in the openinverter-inverter. It ramps down towards 0.

Re: Controlling Leaf inverter via CAN-bus

Posted: Thu Nov 25, 2021 6:35 am
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.

Re: Controlling Leaf inverter via CAN-bus

Posted: Thu Nov 25, 2021 3:04 pm
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?

Re: Controlling Leaf inverter via CAN-bus

Posted: Fri Nov 26, 2021 7:07 am
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...

Re: Controlling Leaf inverter via CAN-bus

Posted: Fri Nov 26, 2021 12:14 pm
by Jack Bauer
Yeah regen cuttoff rpm is raised in proportion to the % of regen selected. Works great.

Re: Controlling Leaf inverter via CAN-bus

Posted: Sat Nov 27, 2021 7:21 pm
by bexander
Got it working, both acc and regen in both directions.
Thank you all for great input!