Gen 2 Charger V5 Software Development Thread

Topics concerning the Tesla front and rear drive unit drop-in board
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Setting up a new thread for development of software for the new STM32F103C8T6 based logic board for the Tesla Gen 2 10kw charger.

Design files (with my screwups fixed) for the boards released on Github :
https://github.com/damienmaguire/Tesla- ... /master/V5

New boards ordered from JLC and will start proper work once they arrive.

Here is my pathetic attempt to flash an LED and pump out some CAN messages.
https://github.com/damienmaguire/Tesla- ... 5/Software

The plan :
1) Ripoff as much of Johannes's code as possible.
2) Download this book into my brain : https://www.amazon.co.uk/Beginning-STM3 ... 274&sr=8-1
3) Offer free boards to people who want to help develop the code then ripoff their hard work for my own benefit.
4)Retire to Lanzarote.
Attachments
2020-01-19 13.53.10.jpg
I'm going to need a hacksaw
User avatar
johu
Site Admin
Posts: 5681
Joined: Thu Nov 08, 2018 10:52 pm
Location: Kassel/Germany
Has thanked: 153 times
Been thanked: 959 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by johu »

One little hint: thou shall use libraries. Try to use as much files from libopeninv unchanged. Check out the "git submodule" command on how to link a copy to your project. You don't have to compile all files, just what you need.
That way you are compatible with the Wifi code as is.
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Gen 2 Charger V5 Software Development Thread

Post by doobedoobedo »

Jack Bauer wrote: Tue Jan 21, 2020 11:49 am The plan :
1) Ripoff as much of Johannes's code as possible.
2) Download this book into my brain : https://www.amazon.co.uk/Beginning-STM3 ... 274&sr=8-1
3) Offer free boards to people who want to help develop the code then ripoff their hard work for my own benefit.
4)Retire to Lanzarote.
I spotted a flaw in your plan - you missed out the "???" step before you got to "profit".
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Oh yeah wasn't it something like :
1)Collect underpants
2)????
3)Profit
I'm going to need a hacksaw
doobedoobedo
Posts: 260
Joined: Sat Jan 12, 2019 12:39 am
Location: UK

Re: Gen 2 Charger V5 Software Development Thread

Post by doobedoobedo »

Jack Bauer wrote: Tue Jan 21, 2020 6:50 pm Oh yeah wasn't it something like :
1)Collect underpants
2)????
3)Profit
I pass on offering to get you started on your new venture :)
pm_dawn
Posts: 36
Joined: Mon Jan 07, 2019 7:19 am
Location: Östersund/Sweden
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by pm_dawn »

I'm interested to help with development.

I have both a master and a slave unit.
And I have done some work on embedded units in the past.
Even with FreeRtos. But not on the Stm however.

send me a pm so we can discuss if I qualify....

Regards
/Per
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Thanks will take you up on that once I have some new boards into stock early Feb. I really screwed up the first design:)
I'm going to need a hacksaw
kendo
Posts: 6
Joined: Mon Sep 02, 2019 10:22 pm

Re: Gen 2 Charger V5 Software Development Thread

Post by kendo »

on the new schematic V5, I'm missing the pats and the connection for CAN_EXTH/L and CANH3/L3
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

These are not implemented on the V5. Please let's keep this thread for software development and post support questions on the charger board support thread.
I'm going to need a hacksaw
rgjones
Posts: 5
Joined: Sun Feb 16, 2020 5:47 pm
Location: United States

Re: Gen 2 Charger V5 Software Development Thread

Post by rgjones »

Hi,
Similarly interested in testing/developing for the V5 board.
This ST part new to me too, but I've worked a lot with similar TI ARM based MCUs, TI-RTOS/FreeRTOS and CANBus etc.
User avatar
Kevin Sharpe
Posts: 1345
Joined: Fri Dec 14, 2018 9:24 pm
Location: Ireland and US
Been thanked: 4 times

Re: Gen 2 Charger V5 Software Development Thread

Post by Kevin Sharpe »

rgjones wrote: Sun Feb 16, 2020 5:52 pm Similarly interested in testing/developing for the V5 board.
The firmware is currently in development but I'm sure you'll find plenty to do once the code is released to GitHub :)

viewtopic.php?f=10&t=78&p=6663#p6663
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Beta firmware for the V5 :
https://github.com/damienmaguire/Tesla- ... er_Gen2_V5

Note this is untested as delays at JLC due to corona virus. Will see if I can cobble something together with a bluepill.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

This firmware also support wifi via the unversal interface with the following parameters being available :

The information will be provided over serial to the esp8266 at 19200 baud 8n1 on uart3 in the form :
vaxxx,vbxxx,vcxxx,iaxxx,ibxxx,icxxx,uaxxx,ubxxx,ucxxx,aaxxx,abxxx,acxxx* where :

va=AC volts Module 1
vb=AC volts Module 2
vc=AC volts Module 3
ia=AC Current Module 1
ib=AC Current Module 2
ic=AC Current Module 3
ua=DC Volts Module 1
ub=DC Volts Module 2
uc=DC Volts Module 3
aa=DC Current Module 1
ab=DC Current Module 1
ac=DC Current Module 1
*=end of string
xxx=three digit integer for each parameter eg va230 = 230volts.
updates will be every 100ms approx.
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

First test of the new STM32 based software is looking good. Tom's menu system working as it should:)
Attachments
2020-02-19 15.19.04.jpg
I'm going to need a hacksaw
tom91
Posts: 1270
Joined: Fri Mar 01, 2019 9:15 pm
Location: Bristol
Has thanked: 97 times
Been thanked: 201 times

Re: Gen 2 Charger V5 Software Development Thread

Post by tom91 »

Wait something I code actually works. ;)

Has the Settings menu now been transformed into something more user friendly? ( I have not dug into the settings menu of the opensource version recently)

I quite like what I achieved with my SimpBMS code, a frozen settings screen that you can just send the corresponding identifier 'number or letter' and value and it 'automatically' refreshes the settings overview.
Founder Volt Influx https://www.voltinflux.com/
rgjones
Posts: 5
Joined: Sun Feb 16, 2020 5:47 pm
Location: United States

Re: Gen 2 Charger V5 Software Development Thread

Post by rgjones »

Sorry for the noob question, but what tools are you using to compile and link the code base.
ST's website shows at least 4 tool options tho TrueSTUDIO (Eclipse/CDT) by Attolic seems to be the default 'free' tool chain.
https://www.st.com/content/st_com/en/su ... -step.html
With TrueSTUDIO, I can open the eclipse project in Charger_Gen2_V5, but build fails as there is no 'make' in the installation. Seems the project is not setup to use the Eclipse/CDT internal builder.
Now I could fix this a few different ways, and happy to use the right make tool from a command line.
Would like to setup my environment the same way you guys do to get started.
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

I'm going to need a hacksaw
jon volk
Posts: 572
Joined: Wed Apr 10, 2019 7:47 pm
Location: Connecticut
Been thanked: 2 times

Re: Gen 2 Charger V5 Software Development Thread

Post by jon volk »

Wow, Gen 2 chargers have really come down in price lately. I think it's time to upgrade from this Lear deal. Ill be happy to do some testing once I get some hardware on order.
Formerly 92 E30 BMW Cabrio with Tesla power
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Thanks Jon
I'm going to need a hacksaw
rgjones
Posts: 5
Joined: Sun Feb 16, 2020 5:47 pm
Location: United States

Re: Gen 2 Charger V5 Software Development Thread

Post by rgjones »

Jack Bauer wrote: Thu Feb 20, 2020 8:15 am Uses the CubeIDE:

https://www.st.com/en/development-tools ... beide.html
Thanks for the tip - no problem now building the V5 code base from github!
Can't wait to get testing - ready to get a board when ready.
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Pleased to announce the new charger boards are working well on the bench. Next up testing under actual charge conditions in the Panzer. I'll make boards available in the shop soon for beta testers.
Attachments
2020-03-13 13.07.32.jpg
2020-03-13 13.07.27.jpg
2020-03-13 13.07.23.jpg
2020-03-13 13.07.19.jpg
I'm going to need a hacksaw
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

So we have our first bug. The proximity pin is used to detect the presence of the charge plug and also to determine the current carrying capability of the cable by means of a resistor divider. In the original arduino code it looks like this :
if ( parameters.type == 2)
{
if ( val > 950)
{
Proximity = Unconnected;
}
else
{
Proximity = Connected;
if ( val < 950 && val > 800)
{
cablelim = 13000;
}
if ( val < 800 && val > 700)
{
cablelim = 20000;
}
if ( val < 600 && val > 450)
{
cablelim = 32000;
}
if ( val < 400 && val > 250)
{
cablelim = 63000;
}
}
}

the arduino uses 10bit adc but I'm guessing the stm32 uses a higher resolution as it reports connected even with 3.3v on the adc pin.
I'm going to need a hacksaw
User avatar
cloudy
Posts: 202
Joined: Wed Oct 02, 2019 12:15 am
Location: UK
Been thanked: 1 time

Re: Gen 2 Charger V5 Software Development Thread

Post by cloudy »

Think the stm32 has a 12bit ADC?
User avatar
Jack Bauer
Posts: 3563
Joined: Wed Dec 12, 2018 5:24 pm
Location: Ireland
Has thanked: 1 time
Been thanked: 87 times
Contact:

Re: Gen 2 Charger V5 Software Development Thread

Post by Jack Bauer »

Yes. Still no luck with this bug. Have confirmed no hardware problems.
I'm going to need a hacksaw
User avatar
Kevin Sharpe
Posts: 1345
Joined: Fri Dec 14, 2018 9:24 pm
Location: Ireland and US
Been thanked: 4 times

Re: Gen 2 Charger V5 Software Development Thread

Post by Kevin Sharpe »

Jack Bauer wrote: Fri Mar 13, 2020 1:46 pm The proximity pin is used to detect the presence of the charge plug and also to determine the current carrying capability of the cable by means of a resistor divider.
It's a long time since I played with this but iirc it's the EVSE that does the cable current measurement and limits its Pilot PWM accordingly. The car only uses Proximity to see whether a cable is connected. In this post you can see more details when using a J1772 connector;

viewtopic.php?f=10&t=78&start=290#p8424

Edit: I've attached the diagram from the 61851 standard. Note the resistors defining the cable current capacity, "RC".
61851_B5.png
Edit2: I've had a chat with one of my colleagues and they reminded me that it was only in later versions of the standard that resistor "RC" was included in connectors at *both* ends of the cable (in early versions of the standard it was at the EVSE end only). When we get access to the workshop i'll check some cables and see whether we can safely assume "RC" is installed in both connectors.

Edit3: I'll open a bug report on GitHub just to capture the potential issue.
This is a personal post and I disclaim all responsibility for any loss or damage which any person may suffer from reliance on the information and material in this post or any opinion, conclusion or recommendation in the information and material.
Post Reply