Tesla Model S/X GEN2 Charger: Difference between revisions

From openinverter.org wiki
Jump to navigation Jump to search
(Added commercial software)
Line 47: Line 47:
== External CAN bus ==
== External CAN bus ==
[[File:Gen2 Charger V5aB2 logic board.jpg|thumb|Gen2 Charger V5aB2 logic board with CAN wired to external pins]]
[[File:Gen2 Charger V5aB2 logic board.jpg|thumb|Gen2 Charger V5aB2 logic board with CAN wired to external pins]]
The V5 version of the board has no connection to the external CAN bus but you can add it with to bodge wires as shown in the picture. You will find CANH and CANL on the 3 pin header underneath the wifi module. Route them over to CONN6 as shown. The upcoming revision will not need this modification.
The V5 version of the board has no connection to the external CAN bus but you can add it with to bodge wires as shown in the picture. You will find CANH and CANL on the 3 pin header underneath the wifi module. Route them over to CONN6 as shown. CONN2.1 (CANH) is connected to CONN6.24, CONN2.2 (CANL) to CONN6.26.
 
The upcoming revision will not need this modification.


If the charger is the first/last device on your CAN bus there is nothing else to do. If it is somewhere in the middle you have to remove the bus termination resistor R1.
If the charger is the first/last device on your CAN bus there is nothing else to do. If it is somewhere in the middle you have to remove the bus termination resistor R1.


Before doing this be aware that all internal CAN traffic is also seen on the external CAN bus.The following IDs are already used and mustn't used by any other device on the bus:
Before doing this be aware that all internal CAN traffic is also seen on the external CAN bus. The following IDs are already used and mustn't used by any other device on the bus:


207, 209, 217, 219, 227, 229, 237, 239, 247, 249, 327, 329, 347, 349, 357, 359, 367, 368, 369, 377, 379, 537, 539, 717, 719, 20B, 21B, 22B, 23B, 24B, 32B, 34B, 35B, 36B, 37B, 42C, 43C, 44C, 45C, 53B, 71B.  
207, 209, 217, 219, 227, 229, 237, 239, 247, 249, 327, 329, 347, 349, 357, 359, 367, 368, 369, 377, 379, 537, 539, 717, 719, 20B, 21B, 22B, 23B, 24B, 32B, 34B, 35B, 36B, 37B, 42C, 43C, 44C, 45C, 53B, 71B.  
Line 76: Line 78:
|DC voltage limit LSB
|DC voltage limit LSB
|DC current set point
|DC current set point
|Bit 1: enable charging
|==1 enable charging
|SoC
|SoC
|
|
Line 103: Line 105:
|
|
|}
|}
[[File:Parameter view of commercial firmware.png|thumb|Parameter view of commercial firmware]]
Example: transmit "0x102 # 0 0x1 0x86 0x14 0x1 50 0 0" to enable charging up to a voltage of 390V and a DC current of 20A, report SoC of 50%.[[File:Parameter view of commercial firmware.png|thumb|Parameter view of commercial firmware]]


== Commercial charger firmware ==
== Commercial charger firmware ==
Line 125: Line 127:


== Commercial firmware usage manual ==
== Commercial firmware usage manual ==
=== Charger connection ===
t.b.d.
=== Parameters ===
The firmware exports a number of parameters to be modified by the user. All modifications are temporary until you hit "Save Parameters to Flash" at the top of the page.
The firmware exports a number of parameters to be modified by the user. All modifications are temporary until you hit "Save Parameters to Flash" at the top of the page.


Line 130: Line 137:


==== idclim ====
==== idclim ====
This parameter is mainly relevant for CAN operation. It is transmitted via CAN to let the vehicle know how much DC current the charger can deliver. Each charger module maxes out at about 15.5A so the maximum total charging current is 46.5A. Since the total power is also limited to 10 kW it depends on the output voltage as well. There is no need to be exact on this, the firmware will automatically limit the AC input current to each charger to the hardware maximum.
This parameter is mainly relevant for CAN operation. It is transmitted via CAN to let the vehicle know how much DC current the charger can deliver. Each charger module maxes out at about 15.5A so the maximum total charging current is 46.5A. Since the total power is also limited to 10 kW it depends on the output voltage as well. There is no need to be exact on this, the firmware will automatically limit the AC input current to each module to the hardware maximum.


==== iaclim ====
==== iaclim ====
Line 154: Line 161:


==== autostart ====
==== autostart ====
This is meant to run the charger off an EVSE. It will start charging as soon as it detects proximity of a Type-2 or Type-1 charging cable. It will also read the current limit of the cable and the current limit transmitted via the Type-2 pilot signal and obey it. When operating off a plain wall outlet, set to off.
This is meant to run the charger off an EVSE. It will start charging as soon as it detects proximity of a Type-2 or Type-1 charging cable. It will also read the current limit of the cable and the current limit transmitted via the Type-2 pilot signal and obey it. When operating off a plain wall outlet, set to off. Charging will then start as soon as the enable input "D1" goes high.


==== type2cable ====
==== type2cable ====
Line 160: Line 167:


==== cancontrol ====
==== cancontrol ====
When on, expect charging instructions via CAN message 0x102 as described above. Charging will start when the enable bit is set. when no CAN message is received for 1s, charging will stop. Note that the digital enable input also needs to high to allow charging.
When on, expect charging instructions via CAN message 0x102 as described above. Charging will start when the enable bit is set. when no CAN message is received for 1s, charging will stop. Note that the digital enable input "D1" also needs to high to allow charging. Also the autostart conditions apply when enabled.


==== idckp/idcki ====
==== idckp/idcki ====

Revision as of 19:15, 9 January 2021

The Tesla GEN2 is a single/three phase 10kW AC charger that was fitted in the Model S from 2012 until it was replaced in the 2016 'facelift' model with GEN3.

One or two GEN2 chargers are installed beneath the rear seats.

"Running a Tesla charger at much under 200v dc will cause it to explode. Yes I know the label says 50 to 450v but it lies. Yes I blew one up discovering this."

Replacement control boards

replacement control board https://github.com/damienmaguire/Tesla-Charger

v5 kit: https://www.evbmw.com/index.php/evbmw-webshop/tesla-boards/tesla-gen-2-charger-logic-board-kit

v5 partially built board: https://www.evbmw.com/index.php/evbmw-webshop/tesla-boards/tesla-gen-2-charger-logic-board-partially-built

Programing

you'll need a st-link v2 smt32 programmer. Unofficial ones are cheaply available from amazon and ebay.

st-link programming utility: https://www.st.com/en/development-tools/stsw-link004.html

stm32_loader.hex https://openinverter.org/forum/viewtopic.php?f=7&t=1119

Two options:

  1. Charger_gen2_v5.hex https://github.com/damienmaguire/Tesla-Charger/tree/master/V5/Software/Binary
  2. Or commercial software: Link to be added stm32_charger.hex

Click "Target --> Connect" from top menu. You want to see the screen get filled with a data dump of symbols. In the upper right of the screen you can see it identified the device.

In the main viewing window are multiple tabs, click the "Binary File" tab to select it.

This will ask to open a file, you choose: "stm32_loader.hex" from OpenInverter.org, download ahead of time. This will change what shows up in the viewing window.

Click "Target --> Program and Verify" from the top menu. This pops up a window, and you can probably just click "Start" on that window. This programs the STM32 chip with the stm32_loader.hex file.

The STM32 on your v5 gen2 Tesla charger Board can now load other files.

You can close the stm32_loader.hex tab, and go back to the "Binary File" tab, which will ask to open another file.

You choose: "Charger_Gen2_v5.hex"

Same as last time, click "Target --> Program and Verify" from the top menu. And click Start.

The STM32 on your v5 gen2 Tesla charger Board now also has the software to run.

You are now done with the ST-Link USB dongle, it's no longer needed.

Future updates can be done via wifi. (must have esp8266 wifi module programed https://openinverter.org/forum/viewtopic.php?f=5&t=8 )

External CAN bus

Gen2 Charger V5aB2 logic board with CAN wired to external pins

The V5 version of the board has no connection to the external CAN bus but you can add it with to bodge wires as shown in the picture. You will find CANH and CANL on the 3 pin header underneath the wifi module. Route them over to CONN6 as shown. CONN2.1 (CANH) is connected to CONN6.24, CONN2.2 (CANL) to CONN6.26.

The upcoming revision will not need this modification.

If the charger is the first/last device on your CAN bus there is nothing else to do. If it is somewhere in the middle you have to remove the bus termination resistor R1.

Before doing this be aware that all internal CAN traffic is also seen on the external CAN bus. The following IDs are already used and mustn't used by any other device on the bus:

207, 209, 217, 219, 227, 229, 237, 239, 247, 249, 327, 329, 347, 349, 357, 359, 367, 368, 369, 377, 379, 537, 539, 717, 719, 20B, 21B, 22B, 23B, 24B, 32B, 34B, 35B, 36B, 37B, 42C, 43C, 44C, 45C, 53B, 71B.

Functionality of external CAN bus

With the CAN bus now available externally you can remote control your charger via CAN and also receive some values from it. The mapping is similar to the CHAdeMO CAN protocol. The feature is only available in the commercial firmware.

Charger CAN protocol
ID Direction Byte 0 Byte 1 Byte 2 Byte 3 Byte 4 Byte 5 Byte 6 Byte 7
0x102 Receive by charger DC voltage limit MSB DC voltage limit LSB DC current set point ==1 enable charging SoC
0x108 Transmit by charger Version=0 Max DC voltage MSB Max DC voltage LSB Max DC current
0x109 Transmit by charger Version=0 DC voltage MSB DC voltage LSB DC current 0 when off, 5 when charging

Example: transmit "0x102 # 0 0x1 0x86 0x14 0x1 50 0 0" to enable charging up to a voltage of 390V and a DC current of 20A, report SoC of 50%.

Parameter view of commercial firmware

Commercial charger firmware

In addition to the open source firmware there is also a commercial firmware. It adds advanced features:

  • Support for the standard open inverter web interface
  • Parameter handling as known from the inverter firmware (see picture)
  • Spot value handling like inverter including plotting, gauges, and logging
  • Over the air update like inverter
  • DC current control
  • CAN control as described above

The firmware requires the board to be flashed with stm32_loader.hex. An Olimex MOD-ESP8266 must be programmed with the openinverter web interface. See here how to flash it to the module. With that done, future updates will happen via the web interface.

Registration

If bought a fully assembled V6 (?) board from the EVBMW webshop you can skip this step.

The firmware will work without registration but charging time is limited to 5 minutes. To overcome this, a board-specific pin must be bought. In order to do this the firmware and web interface must be installed and working.

Go to the openinverter webshop and check out as many pins as you need. When checking out add the serial number(s) of your board(s) in the order comment. You will find the serial number on the bottom of the page as last spot value.

You will then receive an email containing one pin for each board. Enter the pin in the web interface in the "pin" parameter. When the pin is correct it will be automatically saved to flash and your board is ready to be used.

Commercial firmware usage manual

Charger connection

t.b.d.

Parameters

The firmware exports a number of parameters to be modified by the user. All modifications are temporary until you hit "Save Parameters to Flash" at the top of the page.

We will go over all of them.

idclim

This parameter is mainly relevant for CAN operation. It is transmitted via CAN to let the vehicle know how much DC current the charger can deliver. Each charger module maxes out at about 15.5A so the maximum total charging current is 46.5A. Since the total power is also limited to 10 kW it depends on the output voltage as well. There is no need to be exact on this, the firmware will automatically limit the AC input current to each module to the hardware maximum.

iaclim

This is the per-phase AC current limit. When charging from a 3-phase outlet (see below) each module will be allowed this current. When charging from single phase, this current will be equally distributed between the enabled chargers.

idcspnt

DC charge current limit. An additional limit to charge power. It is also mapped to the CAN bus so if you have a BMS that calculates a maximum charge current you can forward this to the charger.

chargerena

Here you can program which charger modules you want to enable. It is a flag channel, so 1 means "Module 1 enabled", 2 means "Module 2 enabled" and 4 means "Module 3 enabled". Combining these flags enables multiple modules, e.g. 5=4+1 enables modules 1 and 3. 7=4+2+1 enables all modules. This is the default. The parameter can not be directly changed, but you have to type "set chargerena 5" next to where it says "Send Custom Command" on the top of the page and then press the button.

udcspnt

This modifies the constant voltage setpoint of the chargers. This value is transmitted directly to the modules without further processing. It lets you add a constant voltage phase to your charge process. When reaching this voltage the chargers will control the current to maintain this voltage.

udclim

This parameters specifies a charge end condition. When the voltage is hit the charging process stops and will not resume until you re-plug the charge cable. If you wish to add a constant voltage phase and control charge end by your BMS, set this parameter higher than udcspnt.

timelim

Another charge end condition. Charge only for the specified time in minutes.

threephase

Specify that the charger is connected to a 3-phase outlet. This allows each module to operate at the current limit specified by "iaclim". Otherwise iaclim is spread equally between the enabled modules.

autostart

This is meant to run the charger off an EVSE. It will start charging as soon as it detects proximity of a Type-2 or Type-1 charging cable. It will also read the current limit of the cable and the current limit transmitted via the Type-2 pilot signal and obey it. When operating off a plain wall outlet, set to off. Charging will then start as soon as the enable input "D1" goes high.

type2cable

When on, expect Type-2 signalling as described above. Otherwise Type-1.

cancontrol

When on, expect charging instructions via CAN message 0x102 as described above. Charging will start when the enable bit is set. when no CAN message is received for 1s, charging will stop. Note that the digital enable input "D1" also needs to high to allow charging. Also the autostart conditions apply when enabled.

idckp/idcki

Can be used to tune the control loop of the DC current PI controller.

pin

Software pin, obtained by registration.