Page 1 of 13

Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 4:34 pm
by johu
I have developed an openinverter-style firmware for the Gen2 Tesla charger, more specifically the boards with STM32 processor like V5aB2.

UPDATE:
Manual in the wiki: https://openinverter.org/wiki/GEN2
Download link: https://openinverter.org/files/stm32_charger.zip
Shop link: https://openinverter.org/shop/index.php ... duct_id=67


UPDATE2:
the firmware will be published as open source soon. If you want to grab it earlier jump on to patreon: https://www.patreon.com/openinverter

I have annoyed Damien by sending him outside in the freezing cold to test it in his BMW :P It works.

More specifically it features
  • All features of the original firmware
  • openinverter parameter handling via web interface
  • openinverter spot value handling via web interface
  • Over The Air update via bin file
  • Plotting and logging
  • DC current set point
  • external CAN control
External CAN control requires routing to internal CAN bus onto the external header as shown on the picture. It has quite a few IDs on it so check for collisions with your existing CAN infrastructure before doing this.
I have mapped out CHAdeMO so it will accept like this

Code: Select all

#0x102 - 8 - 0 udclimh udcliml idcspnt 0 canenable soc 0
Sending SoC will allow implementing a SoC limit in the charger and might be handy for just displaying it.
It will also generate the 108 and 109 message CHAdeMO style.

The firmware won't be open sourced for now. Damien will probably put it on boards he sells off his shop and I will offer the binary via my shop for the likes of 20€ or so. I will put together a short manual before putting it up.

Re: Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 6:03 pm
by joromy
Looks great!
Has the issue with Amp draw jumping up and down, been solved?
Then I want one.

Re: Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 6:10 pm
by New Electric Ireland
This is great news :D

Given it's closed source can we expect some support for this going forward? I'm sure most people would happily pay more for a product with support or for an option to purchase support as required.

Edit: one other request... can you find a way of locking the wifi board in place? We need to pass vibration testing and would like to use the existing boards rather than produce a new one.

Re: Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 6:11 pm
by P.S.Mangelsdorf
johu wrote: Mon Jan 04, 2021 4:34 pm
I have mapped out CHAdeMO so it will accept like this
#0x102 - 8 - 0 udclimh udcliml idcspnt 0 canenable soc 0
Sending SoC will allow implementing a SoC limit in the charger and might be handy for just displaying it.
It will also generate the 108 and 109 message CHAdeMO style.
Ok please excuse the dumb question:
Does this mean the charger control board can also handle implementing CHADEMO? i.e. a separate CHADEMO control board would not be needed if running a Tesla charger with this control board/firmware? Or is this communication with the CHADEMO board?

Re: Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 6:30 pm
by johu
joromy wrote: Mon Jan 04, 2021 6:03 pm Looks great!
Has the issue with Amp draw jumping up and down, been solved?
Then I want one.
We didn't observe this behaviour today, maybe it was a quirk in legacy software.
New Electric Ireland wrote: Mon Jan 04, 2021 6:10 pm This is great news :D

Given it's closed source can we expect some support for this going forward? I'm sure most people would happily pay more for a product with support or for an option to purchase support as required.

Edit: one other request... can you find a way of locking the wifi board in place? We need to pass vibration testing and would like to use the existing boards rather than produce a new one.
Thanks :)
Support will be handled like for all other products, no support by default but can be bought by the hour when needed. I will compile a quick start guide for the firmware.
Locking the module in place would require an extra production step where you put a blob of glue on it. It doesn't fit a locking header.
P.S.Mangelsdorf wrote: Mon Jan 04, 2021 6:11 pm Ok please excuse the dumb question:
Does this mean the charger control board can also handle implementing CHADEMO? i.e. a separate CHADEMO control board would not be needed if running a Tesla charger with this control board/firmware? Or is this communication with the CHADEMO board?
It implements the charger side of CHAdeMO. So say you have a BMS that talks CHAdeMO you could connect it to the charger and it would work. It's just a neatly standardized way to exchange info between charger and car via CAN.

Re: Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 8:46 pm
by joromy
Really happy, if the current jumping up and down issue has been fixed.
Have installed 4 Tasla chargers, and it has been the same issue every time.
It is worse at full power, not so much at low amps.

Damien says: "Yes that's quite normal"
viewtopic.php?f=10&t=78&start=50#p1707
viewtopic.php?f=10&t=78&p=14265&hilit=normal#p14265


Re: Tesla Charger alternative firmware

Posted: Mon Jan 04, 2021 8:50 pm
by jon volk
Exciting stuff, particularly since I'm already using external CAN.

I noticed that was an occasional firmware crash that would require a power cycle to reset on the previous version. It hasn't been annoying enough to look further into it but Ill give this setup a shot.


The jumping up and down I believe may be a CAN timing and/or filtering issue on the charger side. Since I'm running my external can, if I introduce a bunch of other messages onto the bus, this current drop gets worse. If I limit CAN activity of other components when the unit puts out a charge enabled message, it seems to be pretty decent.

Re: Tesla Charger alternative firmware

Posted: Tue Jan 05, 2021 4:30 am
by Bratitude
if I understand correctly, with the chademo communication protocol implemented, one could set up a gen2 charger as a chademo “charger” ? Would just need to produce the charger “start stop”, and “connection check” signals?

Re: Tesla Charger alternative firmware

Posted: Tue Jan 05, 2021 8:19 am
by Jack Bauer
A new board rev will be available soon to support the new firmware. Just simple things like a solder jumper to bring out the can to the external connector, extra filtering on the wifi etc. I'd like to thank Johannes for doing this and I was quite warm in thermals and a snow suit during testing. Why do you think I like Lanzarote so much. Damien don't do cold:)

Once again to address the ramping issue : Yes I have seen it, no I don't know the cause , Tom has said its down to thermal limiting in the modules. It may indeed turn out to be a can issue and like all things we do here the more minds we have working on it the faster it will be fixed.

Re: Tesla Charger alternative firmware

Posted: Tue Jan 05, 2021 1:52 pm
by johu
Bratitude wrote: Tue Jan 05, 2021 4:30 am if I understand correctly, with the chademo communication protocol implemented, one could set up a gen2 charger as a chademo “charger” ? Would just need to produce the charger “start stop”, and “connection check” signals?
Yes exactly. You could wire the "charge allow" pin from the vehicle (it is pulled to GND when vehicle allows charging) to a PNP transistor, which in turn would switch 12V on the enable pin "IN1" of the charger. Then you have full redundancy.
Out1 on the external connector could be used to turn on the vehicles charge relays.

I'm sure Damien would enjoy testing it in his snowsuit :P

Re: Tesla Charger alternative firmware

Posted: Sat Jan 09, 2021 4:03 pm
by johu
So, getting close to releasing. Jack Bauer will do one more test, then the firmware will become available for download. It works like this

- If you buy fully assembled boards from Damien, you will get a fully working board
- If you make your own board from JLCPCB the firmware will allow 5 minutes of charging and then stop
- You then go to the shop, specify the serial number(s) of your board(s) and buy as many pins as you need. You will receive the pin for each board, enter it via the web interface and will have unlimited charging thereafter.
- Patreons who have been supporting me longer than 6 months will get a free pin per $5. More details will be published there soon

Now, I'm looking for 5 volunteers who will go through the registration process and test the charger in their setup in exchange for a free pin.
Ideally I would like to test 5 different setups
- 1 phase wall outlet in the US
- 3 phase wall outlet (EU)
- 1 phase EVSE
- 3 phase EVSE
- Charger as CHAdeMO EVSE

If you're interested please describe your setup here.

Re: Tesla Charger alternative firmware

Posted: Sat Jan 09, 2021 4:56 pm
by jon volk
I can certainly address 1 phase EVSE, probably 1 phase 120v wall outlet if I can find my hacked up extension cord with molex on the end.

Gen2 on v5 board
32kwh of Chevy volt packs
48a capable openevse

Re: Tesla Charger alternative firmware

Posted: Sat Jan 09, 2021 6:17 pm
by johu
Very good.

I started updating the wiki: https://openinverter.org/wiki/GEN2

Re: Tesla Charger alternative firmware

Posted: Sat Jan 09, 2021 10:38 pm
by EV_Builder
Jack Bauer wrote: Tue Jan 05, 2021 8:19 am It may indeed turn out to be a can issue and like all things we do here the more minds we have working on it the faster it will be fixed.
Is there any opensource version which could be used for debugging?
Hope to get there soon then i will start contributing...

Re: Tesla Charger alternative firmware

Posted: Sat Jan 09, 2021 10:42 pm
by Bratitude
I have a wall outlet to molex cable I made for testing the charger. Happy to set up the charger with that. And with j1772.


Tesla gen2
V5 board
18kwh Gen2 volt battery
12kw (300v) outlander phev battery
32amp evse

Re: Tesla Charger alternative firmware

Posted: Sat Jan 09, 2021 10:50 pm
by johu
Also good. Any three phase people?

We will see if the current drop issue persists with this firmware.
I'm not 100% sure how the CAN messages are sequenced in the original firmware, but there was a problem with the STM32 when sending out more than 3 CAN messages at once. The stm32-can module handles that by queueing messages and sending them out once the interface is ready again.

Re: Tesla Charger alternative firmware

Posted: Sun Jan 10, 2021 12:26 am
by jon volk
EV_Builder wrote: Sat Jan 09, 2021 10:38 pm
Jack Bauer wrote: Tue Jan 05, 2021 8:19 am It may indeed turn out to be a can issue and like all things we do here the more minds we have working on it the faster it will be fixed.
Is there any opensource version which could be used for debugging?
Hope to get there soon then i will start contributing...
The gen5 software on Damiens GitHub or mine are workable enough to debug the current dropout. It runs St HAL drivers.

Re: Tesla Charger alternative firmware

Posted: Sun Jan 10, 2021 12:38 am
by EV_Builder
I got EU 3 Phase 400V. It's standard / default in Holland (Single phase 40amps is fased out).
I dont have yet a battery with BMS yet to test it or an Gen 2 Tesla...Yet...

Re: Tesla Charger alternative firmware

Posted: Sun Jan 10, 2021 10:58 am
by Jack Bauer
Right, I'm opening odds on how long it takes for Johannes or me to get the "The charger keeps stopping every few minutes! I want a refund" email.

Re: Tesla Charger alternative firmware

Posted: Sun Jan 10, 2021 1:30 pm
by jon volk
But Damien. I need 100% charge rate, not 99.68%

Re: Tesla Charger alternative firmware

Posted: Mon Jan 11, 2021 5:33 pm
by Bryson
Happy to help test this on my setup as well: single phase EVSE in the US, Gen2v5 board, charging to 425v max and currently experiencing the current drop issue. Also happy to pay for the firmware since it seems my situation is the common one.

Re: Tesla Charger alternative firmware

Posted: Mon Jan 11, 2021 6:31 pm
by johu
Let the testing begin :)

Damien reports the current drop issue is FIXED!

Please follow this manual to install, register and run the software: https://openinverter.org/wiki/GEN2#Comm ... age_manual

Well, instead of going via the web shop send me your serial number via private message.

Report any problems that you run into. Except one: "my charger only runs for 5 minutes" !!

Re: Tesla Charger alternative firmware

Posted: Mon Jan 11, 2021 6:51 pm
by jon volk
So, inquiring minds want to know. Where was issue in drop?

Will upload the code tomorrow hopefully and fire off SN.

Re: Tesla Charger alternative firmware

Posted: Mon Jan 11, 2021 7:12 pm
by johu
jon volk wrote: Mon Jan 11, 2021 6:51 pm So, inquiring minds want to know. Where was issue in drop?
Basically the STM32 has a 3 message CAN send FIFO. So if your code is like
can_send();
can_send();
can_send();
can_send();

Then the last message will be dropped. To get around this you have to implement a software FIFO that stores the excess messages until the hardware FIFO is free again and then sends them out. That's exactly what the CAN module in libopeninv does and that is why building your software on top of stm32-template is super king :D

Re: Tesla Charger alternative firmware

Posted: Mon Jan 11, 2021 8:00 pm
by jon volk
Ahhhhhhh that makes sense. In the code I messed with, I had broken the messages into 2 batches. Since then on other projects I started making a message handler that would put a 1ms delay in once the 3rd mailbox was full to allow them to send before trying to stuff more in. That seemed to work but was pretty ugly. In messing with the vcu code, the libopen stuff seems to work much more elegantly haha.