Page 7 of 8

Re: Tool to manage openinverter via CAN

Posted: Sat Aug 10, 2024 4:53 pm
by evMacGyver
I might be too tired to find my mistake, cleared clara can map and run previously working oic script which no longer works for some reason. Tried with long time used 0.0.9 and also git version 0.1.0.

oic -n 22 can clear
CAN all mapping removed successfully.

oic -n 22 can add tx 0x109 UdcDivider 0 8 0 10
Adding CAN tx mapping with can_id=0x109 param='UdcDivider' position=0 length=8 gain=0.0 offset=10
Command or parameter not supported

CAN log:

Code: Select all

Time Stamp,ID,Extended,Dir,Bus,LEN,D1,D2,D3,D4,D5,D6,D7,D8
18977723,00000616,false,Rx,0,8,40,00,50,03,00,00,00,00,
18978367,00000596,false,Rx,0,8,43,00,50,03,13,EE,00,00,
18980910,00000616,false,Rx,0,8,23,00,30,00,09,01,00,00,
18981786,00000596,false,Rx,0,8,60,00,30,00,09,01,00,00,
18982152,00000616,false,Rx,0,8,23,00,30,01,01,00,00,08,
18982988,00000596,false,Rx,0,8,60,00,30,01,01,00,00,08,
18983209,00000616,false,Rx,0,8,23,00,30,02,00,00,00,0A,
18983990,00000596,false,Rx,0,8,80,00,30,02,00,00,02,06,
Tried can add help example with same error:
oic -n22 can add tx 0x101 temp3 32 8

Code: Select all

Time Stamp,ID,Extended,Dir,Bus,LEN,D1,D2,D3,D4,D5,D6,D7,D8
41307649,00000616,false,Rx,0,8,40,00,50,03,00,00,00,00,
41308306,00000596,false,Rx,0,8,43,00,50,03,13,EE,00,00,
41311027,00000616,false,Rx,0,8,23,00,30,00,01,01,00,00,
41311570,00000596,false,Rx,0,8,60,00,30,00,01,01,00,00,
41312064,00000616,false,Rx,0,8,23,00,30,01,D5,07,20,08,
41312602,00000596,false,Rx,0,8,60,00,30,01,D5,07,20,08,
41312975,00000616,false,Rx,0,8,23,00,30,02,E8,03,00,00,
41313572,00000596,false,Rx,0,8,80,00,30,02,00,00,02,06,

Re: Tool to manage openinverter via CAN

Posted: Sat Aug 10, 2024 5:30 pm
by davefiddes
A gain of 0 looks odd. stm32-sine is happy to set up a map with that it just outputs a constant "10".

Other than that the request looks fine it's just the remote device that doesn't like it.

Re: Tool to manage openinverter via CAN

Posted: Sun Aug 11, 2024 10:08 am
by evMacGyver
Solved. CAN mapping showed none and always "Command or parameter not supported", no matter if I programmed bootloader and Clara with erase. Finally I did STM32CubeProgrammer full chip erase, which I believe is only erasing eeprom, programmer flash with openocd and voila.

Maybe I got into some libopeninv bug or something, but could not reproduce it with oic -n22 can clear tx ; oic -n22 can clear rx commands.

Re: Tool to manage openinverter via CAN

Posted: Sun Aug 11, 2024 10:22 am
by davefiddes
Ah. That sounds a lot like the problem @tom91 got into viewtopic.php?p=73423#p73423 I think there's a bug in the libopeninv code when more complex maps are created.

Re: Tool to manage openinverter via CAN

Posted: Mon Aug 12, 2024 2:05 pm
by davefiddes
I have just release v0.2.0:

What's Changed:
  • Fully automatic firmware upgrade
  • Failed device recovery with or without serial number information
For best performance devices using stm32-CANBootloader should be running release v1.3 or later. This is particularly important when recovering devices on a network with multiple devices at power-on. Note: At this time there isn't a binary version of this release.

I have tested the upgrade process with all versions of the stm32-CANBootloader from 1.0 through 1.3 and it seems to work fine.

Re: Tool to manage openinverter via CAN

Posted: Sat Sep 21, 2024 2:04 pm
by davefiddes
I have just released v0.2.1:

What's Changed:
  • Fix DBC generation for enum and bitfield parameters to apply the gain and offset on the CAN mapping.
Found this while trying to answer a CAN mapping query. I'm not sure it makes a lot of sense to have gains and offsets on bitfield values in particular. It's possible to configure them so generated DBC files should be able to interpret what openinverter devices output.

Re: Tool to manage openinverter via CAN

Posted: Sun Oct 06, 2024 8:33 pm
by Proton
Can anybody here make a video on how to install and connect the BMS? I bought one BMS about 1 year ago but was not able to install the linux tool. Something did not install right. I want to buy 5 more bms boards for my battery but without clear instructions I am going to hold on for now.

Re: Tool to manage openinverter via CAN

Posted: Sun Oct 06, 2024 9:02 pm
by davefiddes
Not sure a video is going to be very helpful. Do you have any details on the CAN adapter you are using, which version if Linux and are there any error messages?

Re: Tool to manage openinverter via CAN

Posted: Fri Dec 06, 2024 11:02 am
by davefiddes
I have just release v0.2.3 of the tool:

What's Changed:
  • Fix problems parsing parameters with Zombieverter V2.20A firmware
  • Add support for python 3.13
Just a minor fix of some niggles with the TorqDerate and CAN3Speed parameters in the recent Zombieverter firmware release. The tool should now behave in a similar, more tolerant, way to incorrectly punctuated parameter names as the web interface(s). So if it works for one tool it should work for all.

v0.2.2 can be ignored. It failed due to some GitHub release signing busywork.

Re: Tool to manage openinverter via CAN

Posted: Sat Feb 22, 2025 12:16 pm
by davefiddes
I've just released v0.3.0 of the tool:

What's New
  • Log symbolic values for enum and bit-field params by default. The old behaviour can be re-enabled with the "--numeric" option.
  • Add a "listparam" command to explain a single parameter.
  • Add a "--debug" option to all commands to allow problems to be investigated more easily.
  • Close CAN connections properly. This addresses problems with some CAN adapters on Windows.

Re: Tool to manage openinverter via CAN

Posted: Sun Apr 20, 2025 4:42 pm
by muehlpower
I still haven't managed to get this tool to work. What am I doing wrong? I have installed python. When I enter 'Python' in the comandline something happens. When I enter 'pip' I get a help text. When I type 'pip install openinverter_can_tool' something seems to be installed. And now? If I enter 'oic' it is unknown.

Re: Tool to manage openinverter via CAN

Posted: Sun Apr 20, 2025 4:58 pm
by davefiddes
If the "oic" command isn't available that sounds like where it is installed to is not on the path. To help out it would be useful to know the platform you are using and the output of the install command. It would also be helpful to know the CAN adapter you would like to use with it.

Re: Tool to manage openinverter via CAN

Posted: Sun Apr 20, 2025 7:27 pm
by muehlpower
I don't know where it was installed, how to find it, nor how to specify or change a path. I am using Windows 10 and python 3.13.3
install.png

Re: Tool to manage openinverter via CAN

Posted: Sun Apr 20, 2025 7:37 pm
by muehlpower
USB2CAN.jpg
this is the adapter I have and want to use

https://www.inno-maker.com/product/usb-can/

Re: Tool to manage openinverter via CAN

Posted: Mon Apr 21, 2025 6:21 pm
by davefiddes
Had a very frustrating day trying to get this to work on Windows 11 (10 should be the same). The TLDR version is that it doesn't at the moment. For the time being I'd recommend using a Linux virtual machine and pass-through the USB CAN adapter to the VM. VirtualBox is your best bet on Windows 10 though I believe WSL can do this on Windows 11. You could also use a raspberry pi or any other Linux box.

What follows is how to set up openinverter_can_tool on Windows with an Innomaker USB2CAN or any other CAN adapter using the Geschwister Schneider protocol.

The problem with being unable to find the "oic" command is because of a missing path. You need to update it using the System Properties | Environment Variables. It should contain

Code: Select all

C:\Users\mb\AppData\Local\Programs\Python\Python313
C:\Users\mb\AppData\Local\Programs\Python\Python313\Scripts
If you look in C:\Users\mb\AppData\Local\Programs\Python\Python313\Scripts you should see an "oic.exe". When you log-out and log back in again it should run from a Command Prompt.

Once this is done you need to install the USB driver for the USB2CAN adapter. To do this you need to download a utility called Zadig. This program assigns a device driver to a specific USB device. When you run the utility pick the "Options | List All Devices" option. Then you pick the "USB2CAN v1 (Interface 0)" in the drop-down:
Screenshot 2025-04-21 185733.png
Change the spin-control next to the green arrow to read "libusbK (v3.1.0.0)" and press the Replace Driver option:
Screenshot 2025-04-21 185855.png
With this done you need to install an additional python driver:

Code: Select all

pip install python-can[gs_usb]
Then you need to set up a CAN configuration so that openinverter_can_tool and other python tools can find your interface. Create a new file using Notepad called "can.conf" in c:\Users\mb with the following:

Code: Select all

[default]
interface = gs_usb
channel = USB2CAN v1
index = 0
bitrate = 500000
The tool should then work for exactly one command until you remove the USB device and plug it back in again (go figure):

Code: Select all

C:\Users\dave>oic scan
Scanning for devices. Please wait...

Found possible openinverter node: 1

C:\Users\dave>
There's something getting screwed up when a command finishes that confuses the interface so that it things it is still in the middle of sending the CAN frame that was sent when the interface was shut down at the end of the previous command. I've no idea whether it's my code or some part of hot-mess of python libraries this lot depends on. I'm not proposing to investigate further until I'm a lot less fed up.

Re: Tool to manage openinverter via CAN

Posted: Mon Apr 21, 2025 6:41 pm
by muehlpower
now i have a bad conscience that i asked. I also spent the day yesterday trying. I also found out about the path and it worked. But I failed with the CAN adapter. I am not a computer specialist and I have no idea about linux. I ordered a new wifi CAN module from Johu after I killed mine. Hopefully it will work with that.
Thanks again for your efforts, maybe someone will find a windows cable solution for configuring that is doable for idiots like me.

Re: Tool to manage openinverter via CAN

Posted: Tue Apr 22, 2025 10:33 am
by davefiddes
Don't worry about asking, you weren't to know it was going to be quite as frustrating as it turned out. Having slept on it, unsurprisingly, I have ideas for a way forward...

Re: Tool to manage openinverter via CAN

Posted: Wed Apr 23, 2025 11:44 am
by davefiddes
I've just released v0.3.1 of the tool:

What's New
  • Include support for serial and slcan python-can drivers by default
  • Update README with details of working and not working Windows CAN interface
    adapters

Re: Tool to manage openinverter via CAN

Posted: Sun Jun 29, 2025 5:01 pm
by davefiddes
I've just released v0.3.2 of the tool which has a minor fix:

What's New
  • Correctly display bitfield parameters with a zero value where a description is provided in the parameter definition.
This makes the output a bit more understandable for parameters with many possible failures I think:

Code: Select all

$ oic read status
status              : None
$ oic read m3_phaseA_lo
m3_phaseA_lo        : OK
$ oic read canio
canio               : 0
The "canio" parameter doesn't have a description so you get a 0 as a fallback.

Re: Tool to manage openinverter via CAN

Posted: Mon Jun 30, 2025 10:47 am
by Bigpie
Mac users, I've got one of these https://www.ebay.co.uk/itm/267167770235, it came with the candlelight firmware on it, but if you go to https://canable.io/updater/canable1.html and stick the slcan firmware on it (you can use tweezers to put it in DFU mode) it then shows up under /dev/tty.XXXX

Code: Select all

[default]
interface = slcan
channel = /dev/tty.usbmodem31101
bitrate = 500000
is my ~/.canrc

and its working great.

Code: Select all

oic -n 3 -d params.json dumpall
Inverter            : GS450H
Vehicle             : BMW_E6x+
Compressor          : Outlander
GearLvr             : None
Transmission        : Auto
interface           : Unused
chargemodes         : Out_lander
BMS_Mode            : Off
ShuntType           : None
InverterCan         : CAN1
VehicleCan          : CAN2
ShuntCan            : CAN1
LimCan              : CAN1
ChargerCan          : CAN1
BMSCan              : CAN1
OBD2Can             : CAN1
CanMapCan           : CAN2
DCDCCan             : CAN2
HeaterCan           : CAN1
MotActive           : BlendingMG2and1


Re: Tool to manage openinverter via CAN

Posted: Mon Jun 30, 2025 11:27 am
by davefiddes
That's brilliant feedback. Thanks! I'll include that in the docs shortly. It looks like that process and adapter would work just as great on Windows and Linux too.

Re: Tool to manage openinverter via CAN

Posted: Mon Jun 30, 2025 12:10 pm
by Bigpie
I had an AI tool generate a GUI for it, and it sorta works, might be a good starting point for something more user friendly. Currently have to flick to the system tab to see the outputs.

Re: Tool to manage openinverter via CAN

Posted: Mon Jun 30, 2025 2:17 pm
by johu
Was just setting out to do the same thing but just modding the ESP web interface to run locally and use oic as a backend.

How hard would it be to add a "dumpjson" command that outputs the json updated with the recent values? Maybe even likewise for the CAN maps?

Re: Tool to manage openinverter via CAN

Posted: Thu Jul 10, 2025 3:25 pm
by Bigpie
I used this tool to log on a short drive, then asked Claude to plot and analyze it.

Much more reliable than the wifi connection.

https://claude.ai/public/artifacts/7a04 ... 48ddac371d

Re: Tool to manage openinverter via CAN

Posted: Thu Jul 10, 2025 5:26 pm
by davefiddes
A wired connection should be a better bet from a reliablity perspective. I'd recommend splashing out for am isolated CAN adapter. WiFi does a good job at isolating laptops from the nasty environment of a car's electrics sort as a neat side-effect.