# Project Specification
## Project Overview
- **Name:** EV Charge Controller Test Board
- **Status:** Review-stage logical schematic only
- **Purpose:** Programmable single-phase AC EV charging controller and test board for IEC/GB/T-style control-pilot and cable-coding experiments.
- **Critical limitation:** This is **not production-ready** and **not safety-certified**. Do not claim compliance and do not generate final manufacturing files from this revision.
## Intended Use
- Bench/review prototype for evaluating EVSE control behavior, CP generation/monitoring, CC/RC/S3 emulation, relay control, and output measurement.
- External upstream RCD/MCB is assumed.
- No RCD or MCB is included on this board.
## Required Hierarchical Sheets
- TOP_LEVEL_INTERFACES
- POWER_MCU_COMMUNICATION
- CP_GENERATION_AND_MONITOR
- CC_PP_RC_R4_AND_DISCHARGE_IDENTIFICATION
- CHARGE_AND_DISCHARGE_CONTACTOR_CONTROL
- AC_MAIN_PATH_AND_BIDIRECTIONAL_MEASUREMENT
- REVIEW_AND_TEST_STATE_TABLE
## What the Device Should Do
- Accept an external isolated 24 VDC control supply.
- Generate IEC/GB/T-style 1 kHz CP signaling in normal and programmable test modes.
- Emulate CC/PP passive discharge-identification and normal charging RC/R4/S3 conditions through `CC_PP_OUT`, while active CP waveform generation remains on a separate `CP_OUT` terminal.
- Switch both line and neutral simultaneously using the two main poles of K1; do not swap L and N.
- Keep PE permanently continuous from PE_IN to PE_OUT; PE is never software-switched.
- Measure output current and voltage after the main relay for monitoring only.
- Support Ethernet, isolated RS-485, SWD, UART debug, watchdog, and service jumper functions.
## Main Features
- STM32G474RET6 MCU control core.
- 24 V to 5 V conversion using LMR33630 and 5 V to 3.3 V using AP63203.
- W5500 Ethernet and ADM2587E isolated RS-485.
- Isolated ±15 V CP analogue supply using WRE2415S-1WR2.
- MCP4922 DAC, REF5050 reference, 74AHCT125 logic buffer, OPA197 analogue stages, ADG1419 high-Z CP interruption.
- HF170F/24-2H1DTF candidate main relay/contactor with auxiliary feedback.
- 40 A / 20 mA CT current measurement and high-impedance L/N voltage measurement.
## System Architecture
```mermaid
flowchart TD
P24[External isolated 24 VDC] --> P5[LMR33630 5 V]
P5 --> P33[AP63203 3.3 V]
P33 --> MCU[STM32G474RET6]
MCU --> ETH[W5500 Ethernet]
MCU --> RS485[ADM2587E Isolated RS-485]
MCU --> CPGEN[CP DAC / Buffer / OPA197 Stages]
CPGEN --> CPSW[ADG1419 CP High-Z Switch]
CPSW --> CPOUT[CP_OUT active CP terminal]
MCU --> CCEMU[RC / R4 / S3 and Discharge Identification Network]
CCEMU --> CCPP[CC_PP_OUT passive CC / PP terminal]
MCU --> RELAY[Main Relay Coil Driver]
RELAY --> ACMAIN[L/N Two-Pole K1 Switching]
ACMAIN --> MEAS[Output Voltage and Current Measurement]
MEAS --> MCU
PEIN[PE_IN] --> PEOUT[PE_OUT Continuous]
```
## Hardware Subsystems
### TOP_LEVEL_INTERFACES
- Named sheet boundary nets and test points for 24V_IN, 5V, 3V3, +15V_ISO, -15V_ISO, **CP_OUT**, **CC_PP_OUT**, PE_IN/PE_OUT, L_IN, N_IN, L_OUT, N_OUT, RS485_A/B, Ethernet, SWD, UART, K1 control/feedback, ADC inputs, and service/watchdog signals.
- Correct external vehicle-side terminals: `PE_OUT`, `CP_OUT`, and `CC_PP_OUT`.
- `CC_PP_OUT` silkscreen text: **“CC / PP”**.
- Do not use a separate `PP_OUT` terminal.
### POWER_MCU_COMMUNICATION
- External isolated 24 VDC input.
- 24V input protection placeholders: fuse, reverse-polarity protection, and TVS. Ratings/coordination are **REVIEW REQUIRED**.
- STM32G474RET6 MCU.
- LMR33630 24 V to 5 V buck; AP63203 5 V to 3.3 V buck.
- W5500 Ethernet with generic RJ45 placeholder marked **VERIFY FOOTPRINT / PINOUT BEFORE RELEASE**.
- ADM2587E isolated RS-485 with TVS and selectable 120 ohm termination.
- SWD, UART debug, watchdog, and service jumper.
### CP_GENERATION_AND_MONITOR
- 1 kHz CP signal.
- Normal mode: +12 V / -12 V.
- Test mode: independently programmable +11 V to +13 V and -11 V to -13 V platforms.
- WRE2415S-1WR2 isolated ±15 V supply.
- MCP4922 + REF5050 + 74AHCT125 + OPA197 + ADG1419.
- 1.000 kOhm 0.1% CP series resistor.
- Mandatory `R1_CP = 1.000kΩ`, 0.1%, 0.5W series resistor between the CP source switching circuit and `CP_OUT`.
- `R1_CP` is the GB/T control-guide equivalent resistor R1; it is not optional and is not merely a protection resistor.
- CP voltage monitor is connected on the `CP_OUT` side of `R1_CP`, relative to `PE_OUT`, and feeds the MCU/control domain through a review-required protection/isolation boundary.
- Physical CP output disconnect/high-Z control is provided for test and engineering modes.
- `CP_OUT` and `PE_OUT` test points are required.
- In GB CP mode, the active CP waveform source may connect through the protected 1k output resistor to `CP_OUT`.
- In EU/US PP mode, the active ±12 V CP generator must be physically disconnected/high impedance.
- Never connect the CP waveform generator to `CC_PP_OUT`.
- The PE-referenced CP analogue monitor domain and MCU/control domain require isolation/protection review.
### CC_PP_RC_R4_AND_DISCHARGE_IDENTIFICATION
- External vehicle signal terminal for passive resistance identification: `CC_PP_OUT`, silkscreen **“CC / PP”**, plus `PE_OUT`.
- No S2 detection/connection.
- **Supersedes earlier terminal interpretation:** `PILOT_OUT` is obsolete. The schematic has been revised to use `CP_OUT` for active CP waveform generation and `CC_PP_OUT` for passive CC/PP resistance networks.
- Normal charging RC/R4 path topology: `PE_OUT -> [selected R4 path OR S3 bypass switch across selected R4] -> selected RC -> RC enable switch -> CC_PP_OUT`.
- R4 and RC are series elements in the normal charging route.
- R4 selection and RC selection are independent; do not force value pairing.
- S3 bypass switch is connected in parallel across the selected R4, so closing S3 bypasses R4.
- The normal RC/R4 path is one complete selectable route.
- RC values: 1.500k, 680R, 220R, with ±3% boundary test selections.
- R4 values: 1.8k, 2.7k, 3.3k.
- External-discharge identification paths are independent direct PE-to-`CC_PP_OUT` paths and do not pass through RC or R4:
- `PE_OUT -> K_DIS_GB -> R_DIS_GB -> CC_PP_OUT`, with `R_DIS_GB = 2.00kΩ`, 0.5W axial flameproof.
- `PE_OUT -> K_DIS_EU -> R_DIS_EU -> CC_PP_OUT`, with `R_DIS_EU = 50Ω`, 1W axial flameproof.
- `PE_OUT -> K_DIS_US -> R_DIS_US (DNP) -> CC_PP_OUT`, vehicle-specific reserve with 1W axial-compatible through-hole footprint.
- No universal US/J1772 discharge resistance is claimed.
- Interlocking: the complete normal RC/R4 route must be mutually exclusive with every discharge-identification route.
- Only one of K_DIS_GB, K_DIS_EU, and K_DIS_US may be active.
- RC and R4 remain independently configurable within the normal charging route.
- All passive resistance routes released must leave `CC_PP_OUT` open circuit.
- `CC_PP_OUT` is used only as a passive resistance network for the vehicle to detect. The board does not measure CC/PP-to-PE voltage and must not include CC/PP voltage sensing.
### CHARGE_AND_DISCHARGE_CONTACTOR_CONTROL
- Candidate: Hongfa HF170F/24-2H1DTF.
- `K_CHG`: two-pole L/N charge contactor candidate HF170F/24-2H1DTF.
- `K_DIS`: independent two-pole L/N discharge-output contactor placeholder.
- `K_CHG` and `K_DIS` must never be closed simultaneously.
- E_STOP_NC hardwired in series with the 24 V coil supply for both contactors.
- >=100 V NMOS drivers, gate protection, flyback suppression, and optocoupler-isolated auxiliary feedback.
- Relay pinout/footprint marked **VERIFY AGAINST SUPPLIER DRAWING OR SAMPLE**.
### AC_MAIN_PATH_AND_BIDIRECTIONAL_MEASUREMENT
- Charge path: `L_IN/N_IN -> K_CHG -> L_VEH/N_VEH`.
- Discharge path: `L_VEH/N_VEH -> K_DIS -> L_DIS_OUT/N_DIS_OUT`.
- PE_IN, PE_OUT, and PE_DIS_OUT are permanently continuous; never switch PE.
- CT placeholder on vehicle-side L conductor for bidirectional current polarity.
- Vehicle-side L/N voltage measurement on `L_VEH/N_VEH` using symmetric high-impedance divider and differential AFE.
- Report RMS voltage/current and signed real power direction in firmware/reporting.
- Heavy 32A copper routing requirements are documentation only, not PCB layout.
### REVIEW_AND_TEST_STATE_TABLE
- Captures normal charge, test, engineering, GB/EU/US discharge candidate modes, normal stop, emergency stop, relay interlock, all-open safe state, and unresolved safety/thermal/isolation/creepage/EMC/manufacturing review items.
## Power and Runtime Expectations
- Powered from external isolated 24 VDC source.
- On-board rails: 24V_IN, 5V, 3V3, +15V_ISO, -15V_ISO, 1V65_BIAS, REF_5V.
- No battery/runtime requirement.
## Physical Design Expectations
- PCB size target: 260 mm x 180 mm.
- 4-layer, 2.0 mm FR-4, 4 oz outer copper.
- 15 mm is the minimum continuous width target for the narrowest L/N heavy-copper path on the outer layers; it is not a thermal parameter.
## Important Design Decisions
- Do not include RCD; rely on external upstream RCD/MCB.
- Switch both L and N with K1; PE must remain permanently continuous.
- Vehicle-side L/N may see reverse AC voltage up to normal input voltage for up to 30 seconds with relay open.
- Use generic mechanical placeholders for HF170 relay, M6 AC terminals, RJ45, CT, and small relays.
- Correct terminal ownership: `CP_OUT` is for active CP waveform generation and CP-to-PE monitoring only; `CC_PP_OUT` is for RC, R4/S3, and GB/EU/US passive discharge-identification resistors only. Never connect the CP generator to `CC_PP_OUT`, and never connect RC/R4/discharge resistors to `CP_OUT`.
## Review Required / Open Safety Checks
- High-voltage safety and creepage/clearance.
- Relay/contactor pinout, footprint, contact rating, auxiliary contact mapping, and coil behavior.
- M6 terminal footprints and current/thermal rating.
- Copper width, bottleneck, via stitching, and temperature rise at 32 A.
- EMC, surge, ESD, transient, and protection strategy.
- CT accuracy, voltage AFE safety, and measurement calibration.
- Regulatory/safety compliance review by qualified personnel.
## Change Notes
- Initial project specification created from user-provided requirements and corrected follow-up attachment.
- Added CC/PP discharge-identification branch requirements and interlock constraints for GB, EU, and US/J1772 reserve branches.
- Corrected terminal architecture again: `PILOT_OUT` is superseded. The board has three external vehicle-side terminals: `PE_OUT`, `CP_OUT`, and `CC_PP_OUT` with silkscreen “CC / PP”. No CC/PP-to-PE voltage sensing is required or allowed.
- Clarified CP output resistor: `R1_CP` is mandatory GB/T control-guide equivalent R1, 1.000kΩ / 0.1% / 0.5W, and CP voltage monitoring is on the `CP_OUT` side of `R1_CP`.
- Schematic revised to restore `CP_OUT` for active CP waveform generation/CP-to-PE monitoring and `CC_PP_OUT` for passive RC/R4/S3 and discharge-identification resistors, without PCB placement/routing/footprint work.
- Full-board component-level schematic pass added the requested sheet groups, discharge-output terminals, K_DIS contactor path, 24V input protection placeholders, and bidirectional measurement documentation without PCB placement/routing/footprint work.