/foccci

Fully Open CCS Charge Controller Interface with QCA7005 PLC modem

Primary LanguageHTMLApache License 2.0Apache-2.0

foccci - The Fully Open CCS Charge Controller Interface

image Hi, I'm Foccci. Just call me [Foksi] or [Fok-See] or just Foxi :-) My real name is "Fully Open CCS Charge Controller Interface", but that's just too difficult to remember.

What I am? I'm a Charge Controller that enables CCS charging of homebrew electric vehicles. I was born in the OpenInverter forum community, https://openinverter.org/forum/viewtopic.php?t=3727, and I'm growing more and more due to the great people there. Inside, I have a QCA7005 PLC modem and an STM32 microcontroller. I'm a piece of hardware, and because hardware alone is quite boring, I'm in a team with Clara, https://github.com/uhi22/ccs32clara, which is dealing with the bits and bytes of our mission. And together, we can do a lot for you.

image

News

2023-12-13 Supercharging works. Halve a dozen boards are spread around the world.

Johu is charging the Touran on the TESLA Supercharger using the hand-populated V3 board: https://openinverter.org/forum/viewtopic.php?p=64563#p64563 and https://www.youtube.com/watch?v=OKg3VUslol8 The first JLC populated boards have been completed manually, only one bug in the schematic needed a small workaround. Boards are on the way to several enthusiasts for further testing. The software is growing thanks to the great openinverter community.

2023-10-25 First Order of Populated Boards

Received four reservations on openinverter forum, and this was the trigger to create version v4.1 with minor layout improvements, and to order a batch of five at JLCPCB. Total cost for five: $127.32 including shipping, taxes and duties. The NCV8402 was out of stock, and the QCA7005 is anyway not in their stock. So the material price is

  • 25€ JLCPCB populated PCB
  • 12€ QCA7005
  • 4€ 2 x NCV8402
  • 1€ RF transformator
  • <1€ connectors for programming and serial line

2023-10-08 Light-Bulb-Demo-Charging on Alpitronic and ABB works

Using the foccci V3 board together with ccs32clara software, the muehlpower voltage sense board, a cheap chinese relay, the light-bulb-demo worked on the first attempt on alpitronics hypercharger and on an ABB triple charger.

image

image

image

2023-07-28 Charging Loop Reached

The foccci board version 2023-07-12 runs the STM32F103 and the QCA7005, and successfully enters the charging loop, with simulated evse by pyPLC. It provides the checkpoint number and some other informations via CAN with 500kBaud. On the other side of the CAN sits an ESP32 Wifi-Kit-32, with a CAN transceiver added. It shows the data of the CAN on its OLED display.

image

2023-07-09 The board starts talking

After the PCBs and QCAs arrived, the soldering was the next challenge. It went well, and the board started talking to the ESP32 running ccs32berta https://github.com/uhi22/ccs32berta

https://openinverter.org/forum/viewtopic.php?p=58627#p58627

2023-06-21 First PCB with the QCA7005

...is ready in KiCad and is sent to JLCPCB. It is a two-layer, and has so many capacitors, that they do not really fit to the place where they would make sense. Caused by taking the schematic from the Millisman design, but changing the size to 1206 for easy hand soldering. Btw: Below five dollars for five PCBs, including shipping, duties and taxes.

2023-06-14 The Idea Is Born

...and the discussion is starting on the OpenInverter forum https://openinverter.org/forum/viewtopic.php?p=57643#p57643

Board versions

V1 June 2023

image

  • Just the QCA7005, exposing the SPI interface.
  • No controller, no voltage regulator, no CP logic.
  • Test result summary: Light-bulb-demo-charging works on alpitronics, with ccs32berta running on ESP32. (https://github.com/uhi22/ccs32berta)

V2 2023-07-12

image

V3 2023-08-17

image

  • HBridge driver DRV8874 for connector lock
  • discrete drivers for RGB LEDs
  • Deutsch Connector 2x12pins
  • added CP and PP sensing
  • changed from 2 layers to 4 layers
  • Test result summary: The new output drivers work with https://github.com/uhi22/ccs32clara. Other tests still in progress.
  • Issues:
    • Diode to 3V3 is missing in the CP sense path (R58). Need to be patched.
    • There is a via near the pin1-corner of the QCA, which is very near to the metal frame at the corner, and may cause shortcut between 1V2 and ground.

V4 2023-09-10

image

  • Prepared for assembling by JLCPCB
  • No 1206 size components anymore. Means: 0805 is the new default size now.
  • Test result summary: PCBs not ordered yet. No testing done yet.
  • Outdated, never produced.

V4.1 2023-10-25

  • functionally identical to V4
  • moved via away from QCA corner to avoid solder bridge
  • silk screen improvements: more component names and better readability
  • Test result summary: one issue found (shortcut on the RX inputs to ground via inductors). After fixing this, everything works fine.

V5 work in progress

  • main goal: sleep-wakeup-logic

Background

The QCA7005 schematic and board was originally designed by Millisman https://github.com/Millisman/QCA7000, then forked to https://github.com/uhi22/QCA7000board and then renamed to https://github.com/uhi22/foccci

Changes to the original Millisman design

Schematic

  • removed JTAG completely

  • removed connector for SPI flash, added testpoints instead

  • ATP_P and ATP_N are reserved analog test points. Leave unconnected without testpoints.

  • ZC_IN connected to ground. Not used.

  • PLL_BYPASS has an internal pulldown. Removed the external pulldown.

  • Removed the LEDs on the GPIO.

  • RSVD06 and 07 are "do not connect". Removed the test points.

  • Bugfix: The ground was missing between C13 and C14.

symbol QCA7000:

  • RSVD01 changed to power_in, because connected to 3.3V
  • RSVD04 changed to power_in, because connected to 1.2V
  • TCK changed from output to input, because this is the test clock driven by debugger. Even if the data sheet says "output".

Footprints in Schematic

  • changed the 100nF to 1206 for easy handsoldering (and back to 0805 for some, to safe space)
  • changed the 10µF to 1210
  • changed other 0603 Cs to 0805
  • changed L and Rs to 1206 (and the beads back to 0805)

Todos for now

Todos for Later

  • The use of the LEDs on GPIO0 to 3 is not clear. Are they used in the automotive firmware at all? GPIO3: on the CCM, this is connected to µC.43 via R8 (0 ohms). Measure the pin.
  • Regarding AMS1117-3.3 for the 3v3 regulators. These are tried and tested, but you may wish to avoid the polarized capacitor by using a more modern regulator. Consider TLV75733PDBV "Stable With a 1-μF Ceramic Output Capacitor"
  • The STM32F103 seems to meet the requirements and it's popular but be aware that it has a basic ARM core with no FPU. And: Do we need a low-power variant (stm32L4 series)?
  • Low-power concept is missing. Is the unit permanently powered? Do we need sleep/wakeup via inputs and/or CAN?
  • The QCA7005 is labelled QCA7000.
  • missing the JTAG port pull down resistors on the QCA
  • Could do with one more processor decoupler so that a cap can be dropped right against every package power pin.
  • Would be worth adding lines to the QCA7005 Reset (so that is can be reset without a power cycle) and the Int pins (just in case it's needed in the future).
  • Might put a Schottky protection diode on the temperate sense inputs.
  • Clarify interface (electrically and mechanically)
  • supply voltage measurement (to be able to adjust the PWM for contactors according to the supply voltage, and just for info)

Finished Todos

  • move as much as possible bottom layer components to upper layer, to allow population by JLBPCB
  • adapt layout for changed footprints
  • check/remove/correct the JLCPCB part numbers for all parts. Most parts now 0805.
  • add protection diode for CP sense
  • CP sensing
  • 5V on the connector for supply of the muehlpower high voltage sense board
  • Clarify expected contactor current and use appropriate drivers
  • Footprints for the bigger capacitors too small. -> Use 1210 for C65, C66, C67,
  • Many texts in the silk screen are not readable due to overlap with solder or components
  • Some of the many capacitors on the supply lines could be removed
  • Use 0805 for all 100nF, instead of mixing 0805 and 1206.
  • The EN pin of the CAN transceiver should have the flexibility to solder-bridge to GND and 3V3, to allow different type of transceivers.
  • Change footprint of the test points for flash programming, so that squared connector pins fit into.
  • highside LED drivers for RGB button
  • VDDA of the STM32 needs additional 1µF according to STM application note AN2834. https://www.st.com/resource/en/application_note/an2834-how-to-get-the-best-adc-accuracy-in-stm32-microcontrollers-stmicroelectronics.pdf chapter 4.2.1 -> C14 added.
  • add port locking driver
  • Complete the schematic and the layout for the DRV8874 h-bridge driver
  • add PP detection
  • change to 4 layers
  • One of your AMS1117 seems to have a 100nF output cap and the other doesn't.
  • 470u input cap is an electrolytic? Yes.
  • Which connector? DTM13-12PA-12PB-R008 https://openinverter.org/forum/viewtopic.php?p=58697#p58697
  • HCT04: Risk of activating the contactors if the controller power fails. Find a better solution.
  • Check boot config on GPIO 0 to 2.
    • GPIO0: High during boot to boot from the SPI Flash. (pin60) CCM: R9 is 3k3 to 3V3.
    • GPIO1: must be pulled low during reset. (pin61) CCM: R11 is 3k3 to ground.
    • GPIO2: 0=legacy SPI, 1=burst SPI. Which is used in the CCM? (pin62) CCM: R10 is 3k3 to 3V3, and the not-populated R27 into direction of µC.
      • connect the GPIO2 with pullup to 3V3
  • add LEDs for functional check
  • add mounting holes
  • correct voltage divider in the TPS54302
  • 3V3_uC and NRST on connectors for debugger
  • removed the wrong part number and datasheet for the 8MHz XTAL
  • larger footprint for L10: From 1206 to 1812
  • check all pins -> all plausible with the data sheet.
  • check the QCA footprint -> fits.
  • assign footprint to all components in the schematic
  • add CP logic
  • add microcontroller
  • add power supply
  • add contactor driver outputs
  • add port temperature sensor inputs
  • Takeover from CCM:
    • RBIAS (pin 51, R9). In the CCM this is R19 with 2,5k. Used 3k || 15k, this is exactly 2k5.
    • BIAS_REF (pin 40, R6). In the CCM this is R23 with 6,2k. -> Changed from 2k5 to 6k2 in the schematic. Populated 6k8.
  • What's going on with the missing processor Gnd pins, are they mapped within the part? Yes, in the layout they are correct.
  • Add LIM-like current input for HVDC voltage measuring, https://openinverter.org/forum/viewtopic.php?p=58839#p58839

Interface

(This is just a draft. Work in progress. This is NOT matching the interface of the current draft board.)

  1. Supply 12V (not decided whether switched or permanent)
  2. Supply Ground. Also wired to PE of the CCS inlet.
  3. CANH
  4. CANL
  5. CP (CCS inlet)
  6. PP (CCS inlet)
  7. Contactor1 (low-side switch 2A permanent, 5A peak)
  8. Contactor2 (low-side switch 2A permanent, 5A peak)
  9. Sensor ground (for temperature sensors and analog inputs)
  10. Temperature1 (CCS inlet) NTC or PT1000
  11. Temperature2 (CCS inlet) NTC or PT1000
  12. Temperature3 (CCS inlet) NTC or PT1000
  13. Analog_in1, connector lock feedback. Internal pull-up, external resistor to ground.
  14. Digital_in1, charge stop button. Internal pull-up, external switch to ground.
  15. HVDC_in (current input for HV DC voltage measurement, LIM compatible)
  16. LED_RED (Charge port/button colored illumination) 12V highside output
  17. LED_GREEN (Charge port/button colored illumination) 12V highside output
  18. LED_BLUE (Charge port/button colored illumination) 12V highside output
  19. Connector Lock Motor 1 (12V=lock)
  20. Connector Lock Motor 2 (12V=unlock)

Optional / to discuss 19. Input for fuel flap feedback switch 20. Output for fuel flap opening actuator 21. Input for HV contactor feedback 22. Charge port illumination (RGB WS2812?) 23. GPIO spare (12V capable input and low-side output driver) 24. Analog input spare (0 to 20V capable input)

Connector and Housing

Ideas: https://openinverter.org/forum/viewtopic.php?p=59972#p59972

Plan:

Power supply options

The OpenInverter VCU supply

From openinverter VCU (https://github.com/jsphuebner/stm32-vcu/blob/master/Hardware/GS450H_VCU_V3%20-%20Schematic.pdf)

The zombieverter supply

From https://github.com/jsphuebner/stm32-vcu/blob/master/Hardware/Zombie/ZombieVerter_V1%20-%20Schematic.pdf

The Catphish supply

From https://openinverter.org/forum/viewtopic.php?p=58555#p58555

Plan

  • Reverse-polarity diode: SS54B-HF, 40V, 5A.

CAN Transceiver

Requirements

  • 8V to 30V power supply
  • PLC communication
  • CAN communication
  • CP level handling (and -detection?)
  • PP detection
  • 12V highside LED drivers (for RGB LEDs as in BMW LIM)
  • Contactor driver (with PWM?) for two contactors
  • Charge port temperature sensing (2 channels, either NTC or PT1000)
  • Connector lock motor bridge and connector lock feedback
  • Optional:
    • Analog input for HV voltage sensor at the charging port
    • fuel flap switch
    • button to start/stop the charging process
    • HV contactor feedback

Requirements for the low-power-mode

  • The foccci shall fall in low-power-mode, if not needed. The consumption shall be less than 5mA during this mode.
  • The foccci shall use the enable pin of the step down converter TPS54302 to shut down the power supply.
  • The following ways shall be used to activate the high-power-mode:
    • CP line: A significant voltage (above 4V) for a significant time (at least some milliseconds).
    • Button: A button to ground, internally pulled-up to 12V, if pressed long enough (at least some milliseconds).
    • microcontroller: The STM32 shall be able to keep itself powered by using a toggle pin. In case of stuck to high or low, the foccci shall power-down.
    • Not planned at the moment: Wakeup via CAN communication. This would be a helpful use case, if the user wakes the car via remote key (unlock), and the connector is unlocked by this activity.

Controller

STM32 selection:

Overview: http://stefanfrings.de/stm32/stm32f1.html

https://www.st.com/en/microcontrollers-microprocessors/stm32f103.html

  • STM32F103C8T6 ("blue pill") 64kB Flash and 20kB RAM too small. -> FAIL
  • STM32F401CC ("black pill") 256kB Flash and 64k RAM. No CAN -> FAIL
  • STM32F103RC 256k Flash, 48k RAM, CAN
  • STM32F103RD 384k Flash, 64k RAM, CAN (10 pieces 22 euro on Aliexpress)
  • STM32F103RE 512k Flash, 64k RAM, CAN (10 pieces 24 euro on Aliexpress)
  • STM32F303RE (Nucleo demo board available) (STM32F303RET6) 512K Flash, 80k RAM, LQFP-64, 1 CAN. (6 euro on Aliexpress)

Programming:

  • en.st-stm32cubeide_1.12.1_16088_20230420_1057_x86_64.exe

First run of the June 2023 version

  • Starting with power suppy connected to the 3V3, but set to 0V. Slowly increase the voltage to 0.5V. Observe the current. No current is good.
  • Measure, whether the DVDD pins of the QCA and 3 pins of the Flash have 0.5V.
  • Connect multimeter to 1V2, and turn the power supply slowly up.
  • With 2V, the board draws 4.5mA.
  • At 2.7V, the current jumps from 6mA to 13mA. This is when the 1.2V regulator starts delivering its intended output voltage.
  • At 3.3V, the current is 20mA. This does not look like normal operating current.
  • On the L10 input, there is a 0V/3.3V quare wave with 600ns cycle time. This looks normal for the step-down-converter.
  • On the R6 (both sides), there is the 25MHz clock, with ~1V amplitude.
  • The Reset line is 3.3V (no reset). When pulling it to ground, the current consumption increases from 20.8mA to 23mA.
  • The CS of the Flash is permanent high. This means, the QCA does not want to load its programm code from the Flash. Something is wrong.
  • The RBIAS and R_BIASREF were not populated. Added them.
  • Looks better: At 3V3, the current is 80mA. At the CS of the Flash there is activity for one second after power-on. Seems the QCA is fetching its program code.
  • Connect the ESP32 with the ccs32berta via SPI, using 220 ohm protection resistors in all four SPI lines. ESP powered via USB, QCA powered from 3.3V bench power supply. Result: The Berta finds the modem and starts the SLAC.

Programming the SPI Flash

An introduction how to use a Raspberry to program the SPI flash is here: https://www.rototron.info/recover-bricked-bios-using-flashrom-on-a-raspberry-pi/ The connection is quite simple: SPI_FLASH_programming_with_Raspberry.jpg

Make sure that SPI is enabled in the settings of the Raspberry. Install the flashrom tool: sudo apt-get install flashrom The docu of flashrom is here: https://www.flashrom.org/Flashrom

Check whether the device is detected: flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=2000 -V

Binary is available here: https://github.com/uhi22/Ioniq28Investigations/blob/main/CCM_ChargeControlModule_PLC_CCS/CCM_FlashDump_SpiFlash_2MB_Ioniq_00_33_79.bin

For viewing the binary, a hex editor can be used, e.g. http://www.funduc.com/fshexedit.htm

To flash the binary file to the SPI flash: flashrom -p linux_spi:dev=/dev/spidev0.0,spispeed=2000 -w myfile.bin In the case that to tool complains that multiple flash chip definitions match the detected chip, choose the correct one with the option -c "MX25L...something...

image image

Create Fabrication Output for JLCPCB

Starting with KiCad7, the The xsltproc appears to have been removed. So the procedure to create the BOM needs to be adjusted. In https://gist.github.com/arturo182/a8c4a4b96907cfccf616a1edb59d0389 we find, that there is a plugin now: "Fabrication Toolkit". This can be installed with the "Plugin and Content Manager" in the KiCad main window. Then, in the PCB editor, use the FabricationToolkit from the toolbar. This creates a new folder in /production/, which contains a zip with Gerber and drill files, and also the BOM, positions and designator files.

The docu of the Fabrication Toolkit is here: https://github.com/bennymeg/JLC-Plugin-for-KiCad

Some of the IC footprints have the wrong orientation in the JLCPCB viewer. The Fabrication toolkit offers the possibility to rotate (and shift, if necessary) the footprints, by adding in the schematic an attribute 'JLCPCB Rotation Offset'. Thanks to jrbe for the hint in https://openinverter.org/forum/viewtopic.php?p=61049#p61049

JLCPCB offers

Offer 2023-08-27: 5 PCBs, 2 populated.

  • Option A: All available components: $82, which includes Extended components fee: $45.30
  • Option B: Only basic components. $21. Plus shipping and duties, = $38.

Offer 2023-08-28: 5 PCBs, 5 populated.

  • Total $107 for 5 populated PCBs, plus shipping ($13) and duties and taxes ($23). Plus QCA, connector, inductor, transformator, housing.
  • Includes $42 extended components fee.

Soldering Lessons

solder_lessons.md

Credits

Thanks to Millisman for the initial board design.

Thanks to celeron55, mikeselectricstuff, Zieg, catphish, projectgus, chrskly, johu, Infant, muehlpower, crasbe, royhen99, asavage, Pete9008, P.S.Mangelsdorf, grgumxlm, royhen99, MeKe, mstegen, jrbe, Bigpie, xvyDFatih, olegiv, ns0708, f0ld, explorer232, dougyip, Gabriel, tom91, quentin42, maciek16c, apple2, CCSknowitall on the openinverter forum for the helpful discussions, proposals, reviews, tests and questions.

Special thanks to projectgus for organizing the chips.

Thanks to cookie_kater1 for the logos.