47 lines
3.5 KiB
Markdown
47 lines
3.5 KiB
Markdown
---
|
||
type: concept
|
||
tags: [hardware, patrol, inputs, ch422g, wiring]
|
||
updated: 2026-09-29
|
||
---
|
||
|
||
# Diff-lock inputs (DI0 rear, DI1 front)
|
||
|
||
The Patrol has two differential locks. Their switches put **+12 V on a wire while a diff is locked** (source: user, 2026-09-29). The front can only be locked after the rear, so the valid states are: none, rear only, rear + front (source: user). The Main CTRL shows them on the Driveline screen from its two isolated inputs.
|
||
|
||
## Wiring
|
||
|
||
| Terminal (16-way block) | Connect to |
|
||
|---|---|
|
||
| `DI0` | rear diff-lock wire (+12 V = locked) |
|
||
| `DI1` | front diff-lock wire (+12 V = locked) |
|
||
| `DI_COM` | vehicle ground (chassis, same ground as the board's `GND`) |
|
||
|
||
This is Waveshare's "PNP wet input / high-level trigger" wiring: `DI_COM` to the negative pole, 5–36 V DC on the input (source: [[esp32-s3-touch-lcd-5b-waveshare-wiki]]). Tap the wires in parallel with whatever the Patrol already drives with them (dash lamp); each input draws only ~3 mA.
|
||
|
||
## Circuit (source: [[esp32-s3-touch-lcd-5-schematic]], sheet 1, "DI/DO")
|
||
|
||
- `DINx` → PC814 LED (bidirectional, so polarity does not matter) → 3.6 kΩ (R78 / R73, 1206) → `DI_COM`. At 12 V: (12 − 1.2) / 3.6 k ≈ **3.0 mA**; at 14.4 V charging ≈ 3.7 mA.
|
||
- 100 nF across each input (C100 / C101) filters spikes.
|
||
- `DI_COM` is also fed from 5 V through D4 (1N5822) + R79 220 Ω. That is what makes the "dry contact" mode work (`DI_COM` left open, the input switched to ground). With `DI_COM` on ground, as here, that path draws ~20 mA from the board's 5 V rail `(unverified: read from the schematic, not measured)`.
|
||
- Output side: the phototransistor pulls `DI0` / `DI1` (4.7 kΩ to 3V3) **low** while current flows. `DI0` = CH422G **EXIO0**, `DI1` = **EXIO5** (net table on the same sheet). So **locked = bit reads 0**.
|
||
|
||
## How the firmware reads them `(repo)`
|
||
|
||
The CH422G's IO0–7 are **one bank, all inputs or all outputs**, and the same bank drives touch reset (EXIO1), backlight (EXIO2) and LCD reset (EXIO3). The firmware switches the bank to input for about 0.1 ms per read (three I2C transactions: WR_SET 0x00, read, WR_SET 0x01), 4 times a second, under the LVGL lock. The chip keeps its output latch, so the outputs return to their previous levels. Another project does the same on a running display (source: github.com/VaAndCob/waveshare-esp32-s3-5inch-ch422g-driver, `EX_Read()`).
|
||
|
||
> [!warning] Not yet verified on this board
|
||
> Whether the 0.1 ms float disturbs the panel (flicker) or touch is **unknown** until tried. That is why the feature sits behind **Settings → System → Diff lock inputs**, default OFF. A board without the wiring never flips the bank. If the panel flickers with the switch on, turn it off. The fallback is to move the inputs to spare GPIOs on the Inst. Cluster.
|
||
|
||
A state counts after two equal reads, so it can lag the real switch by up to 0.5 s. Front-locked-without-rear is shown red on the Driveline, as a wiring or switch fault.
|
||
|
||
## Test on the bench
|
||
|
||
1. Settings → System → Diff lock inputs ON. The row's sub-line shows "Now: both open".
|
||
2. Put 12 V (the board's own VIN supply) on `DI0`, with `DI_COM` on `GND`. It should show "rear LOCKED", and the Driveline REAR pill turns amber. Then do the same on `DI1`.
|
||
3. Console: `difflock status` prints the raw IO byte: bit 0x01 (rear) and bit 0x20 (front) are SET while open, clear while locked.
|
||
4. Watch the panel for flicker while the switch is on (see the warning above).
|
||
|
||
## Related
|
||
|
||
[[esp32-s3-touch-lcd-5b]] · [[esp32-s3-touch-lcd-5-schematic]] · [[patrol-instrument-cluster]]
|