Skip to content

fix(fw): 4.3C IO expander bootloop — use direct register protocol#3

Merged
yuchou87 merged 2 commits into
mainfrom
fix/43c-io-expander
Jun 20, 2026
Merged

fix(fw): 4.3C IO expander bootloop — use direct register protocol#3
yuchou87 merged 2 commits into
mainfrom
fix/43c-io-expander

Conversation

@yuchou87

Copy link
Copy Markdown
Owner

Symptom

Flashed 4.3C firmware boot-loops; screen never lights up. Serial log:

ch422g: write_output_reg: Write WR-OC reg failed
ch422g: esp_io_expander_new_i2c_ch422g: Reset failed
ESP_ERROR_CHECK failed ... display_43c.c:36  board_display_init
abort()

Root cause

The board's IO expander (schematic U10) is not a real CH422G — it's a custom MCU-based expander (it exposes SWDIO/PWM/ADC pins, which a CH422G lacks). It speaks a simple register-pointer protocol at I2C 0x24 (reg 0x02 = direction mask, reg 0x03 = output latch). The vendored Espressif esp_io_expander_ch422g driver uses the real-CH422G multi-address protocol (writes to 0x23/0x38/…), which NACKs here → esp_io_expander_new_i2c_ch422g aborts in board_display_init → boot loop.

(The Task-2 review recommended keeping the vendored driver over a hand-rolled one; on real hardware that was the wrong call — the vendored driver doesn't match this board's expander.)

Fix

Talk to the expander directly with two I2C register writes (matches Waveshare's reference io_extension, which the knowledge base documents as working on this exact board). Remove the vendored esp_io_expander*.{c,h} + stub header. Also silence the intentional legacy-i2c deprecation notice.

Verified on hardware

Boots past the IO expander → RGB + LVGL init → TinyUSB composite enumerates as TokenPulse / Espressif with CDC /dev/cu.usbmodemTP_00011 + HID. No more abort. (Visual render + end-to-end data push still to be eyeballed.)

yuchou87 added 2 commits June 20, 2026 08:59
The board's IO expander (schematic U10) is a custom MCU expander, NOT a real
CH422G: it has SWDIO/PWM/ADC pins and speaks a register-pointer protocol at
I2C 0x24 (reg 0x02 = direction mask, reg 0x03 = output latch). The vendored
Espressif esp_io_expander_ch422g driver uses the real-CH422G multi-address
protocol (0x23/0x38/...) which NACKs on this board -> esp_io_expander_new_i2c
aborts in board_display_init -> boot loop, screen never comes up.

Fix: talk to the expander directly with two I2C register writes (matches
Waveshare's reference io_extension, verified on hardware). Remove the vendored
esp_io_expander*.{c,h} + stub header. Silence the legacy-i2c deprecation notice.

Verified on hardware: boots past IO expander, RGB+LVGL init, TinyUSB composite
enumerates as 'TokenPulse' (CDC /dev/cu.usbmodemTP_00011 + HID), no more abort.
…ffer

The static dashboard only produced dirty regions for the first frame, so with
avoid_tearing's two RGB framebuffers only one ever got painted; the panel
flashed white whenever it swapped to the never-drawn second framebuffer.
Set full_refresh so every frame repaints the whole screen -> both framebuffers
always hold the complete image. Compile-verified.
@yuchou87 yuchou87 merged commit bd31faa into main Jun 20, 2026
4 checks passed
@yuchou87 yuchou87 deleted the fix/43c-io-expander branch June 20, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant