52 lines
4.7 KiB
Markdown
52 lines
4.7 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. The user first described the wires as carrying **+12 V while a diff is locked**. In the car, the screen then showed the opposite (verified by the user, 2026-09-29): the wires carry current while unlocked and none once locked.
|
||
|
||
> [!warning] Polarity in the car is inverted
|
||
> On the bench, 12 V on DI0 showed locked (verified). In the car, the same firmware showed locked while unlocked and open while locked (verified, 2026-09-29). The likely cause is the usual lamp wiring: the dash lamp is fed +12 V and the diff's position switch grounds it on lock. A wire tapped between the lamp and the switch then sits at about 12 V through the lamp filament while unlocked, and at 0 V once the switch closes `(unverified: wiring not traced)`. Fix: the per-board **Inverted** switch (Settings → System, diff-lock row) or `difflock invert on` `(repo)`. With it on, a broken wire reads as *locked*, which shows up as amber, not as a silent "open".
|
||
|
||
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 (in the car: 12 V = UNlocked, so turn Inverted on) |
|
||
| `DI1` | front diff-lock wire (same) |
|
||
| `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. The Driveline draws a top view of the chassis, after the user's sketch. A locked axle turns amber: axle, tyres filled, and an X on the diff. There is no text; the drawing alone carries the state (user, 2026-09-29). Front locked without rear turns the front axle red, as a wiring or switch fault (verified on the bench by the user, 2026-09-29, with the earlier pill display: DI1 alone showed red, both inputs showed amber).
|
||
|
||
## 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 rear axle in the Driveline chassis drawing turns amber with an X on the diff. 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]]
|