Diff-lock inputs: DI0 rear / DI1 front via CH422G EXIO0/EXIO5 (bank flipped to input per read), Settings > System switch default OFF, DIFF LOCK pills on the Driveline, 'difflock' console; wiki diff-lock-inputs
Firmware / build (push) Successful in 7m26s
Firmware / build (push) Successful in 7m26s
This commit is contained in:
@@ -13,6 +13,7 @@ Catalog of every page in the wiki. Read this first when answering questions. Kee
|
||||
- [[bmw-m57n-engine]] — the 3.0L BMW diesel whose CAN bus we read; E60/E65 donor (confirmed), DDE ECU, auto box with EGS on bus
|
||||
- [[nissan-patrol-swap]] — the target vehicle: Patrol receiving the M57N + BMW auto; the tapped bus is a BMW island in a Nissan
|
||||
- [[esp32-s3-touch-lcd-5b]] — Waveshare 5" display board (Main CTRL); onboard TJA1051 CAN transceiver, 7–36 V input, pinout, PSRAM/LCD gotchas — **flash writes flicker the RGB panel, full-screen fades stutter, internal RAM nearly full, opening the serial port resets the board unless DTR/RTS are low; Wi-Fi scans caused the flickering dots; all screens hand-coded since 2026-09-27**
|
||||
- [[diff-lock-inputs]] — **2026-09-29**: Patrol diff locks (+12 V = locked) on DI0 rear / DI1 front, `DI_COM` to ground; PC814 → CH422G EXIO0/EXIO5 (active low); the bank flip per read is unverified for panel flicker, so it is behind a Settings switch, default OFF
|
||||
|
||||
## Concepts
|
||||
|
||||
|
||||
@@ -218,3 +218,7 @@ User renamed Controller A → **Main CTRL** and Controller B → **Inst. Cluster
|
||||
## [2026-09-28] update | Deep-sleep feature REMOVED (user decision) - and the lesson it left
|
||||
|
||||
The "Sleep when the car is off" switch and both power managers are gone: code, Settings row, NVS key, the `CFG_SLEEP_WHEN_SILENT` bit in the shared header, the wiki page and the cheat-sheet entries. Reason: on the bench the Main CTRL's panel showed flickering white edges after a sleep, and it stayed that way through resets and even a USB flash of release v0.1.8. Cause, understood too late: `gpio_hold_en()` on the 20 RGB panel lines (added to blank the panel in sleep) lives in the RTC domain and **survives every reset except a power cycle** - no firmware without a matching `gpio_hold_dis()` at boot can drive the panel again. Only pulling the power clears it. **Rule for the future: never use GPIO hold / deep-sleep hold on this board's panel lines, and never send a board to deep sleep from the console without the user's go-ahead** (the USB port vanishes and only reset or power brings it back). The boards stay awake whenever powered; if power saving is ever wanted again, do it in hardware (ignition-switched supply).
|
||||
|
||||
## [2026-09-29] update | Diff-lock inputs on DI0 / DI1
|
||||
|
||||
The user wants the two Patrol diff locks (+12 V while locked; the front only locks after the rear) shown on the Main CTRL. From the schematic: DI0 = CH422G EXIO0, DI1 = EXIO5, active low behind PC814. The CH422G's IO0-7 are one all-in/all-out bank shared with touch reset, backlight and LCD reset, so the firmware flips the bank to input for about 0.1 ms per read, 4 Hz. It is behind a Settings switch, default OFF, until tried on the bench for flicker. New page [[diff-lock-inputs]]; the schematic source page now carries the input circuit and the EXIO net table.
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
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]]
|
||||
@@ -28,6 +28,7 @@ Raw: `raw/ESP32-S3-Touch-LCD-5-Sch.pdf` (3 sheets, V1.2), re-downloaded 2026-09-
|
||||
- CAN: `CANTX` = IO15, `CANRX` = IO16 (matches `(repo)`); RS485: `RS485_TXD` = IO44, `RS485_RXD` = IO43 (matches [[esp32-s3-touch-lcd-5-intro-photo]]).
|
||||
- SD card on `MOSI` IO11 / `SCK` IO12 / `MISO` IO13, `SDCS` on CH422G `EXIO4` — the pin facts needed for the SD "black box" idea in [[obd-diagnostic-polling]].
|
||||
- Isolated outputs `DO0`/`DO1` via PC817 optocouplers driven from `OD0`/`OD1` (CH422G), inputs `DI0`/`DI1` via PC814.
|
||||
- Input detail (read 2026-09-29 for [[diff-lock-inputs]]): `DINx` → PC814 LED → 3.6 kΩ 1206 → `DI_COM`, 100 nF across. `DI_COM` is also fed from 5 V via D4 1N5822 + R79 220 Ω, for dry contacts. The phototransistor pulls `DI0`/`DI1` (4.7 kΩ to 3V3) low. The net table maps `DI0` = **EXIO0** and `DI1` = **EXIO5**. The rest of the bank: EXIO1 `CTP_RST`, EXIO2 `DISP`, EXIO3 `LCD_RST`, EXIO4 `SDCS`.
|
||||
- Strapping pads `R87–R94` (IO0/IO3/IO45/IO46).
|
||||
|
||||
## Related
|
||||
|
||||
Reference in New Issue
Block a user