Files
AutoFilm-ESP32/docs/JC4827W543_PIN_AUDIT_VERIFIED.md
gronod 73f3158b27
ci / test (push) Successful in 1m3s
ci / firmware (wroom, sdkconfig.wroom, esp32) (push) Successful in 3m58s
ci / firmware (jc4827w543, sdkconfig.s3, esp32s3) (push) Successful in 4m1s
Update pin audit documentation labels
2026-09-16 20:43:25 +01:00

7.9 KiB
Raw Permalink Blame History

JC4827W543 pin audit

Comparison of the GPIO assignments in this tree against the vendor documentation at https://github.com/lsdlsd88/JC4827W543 (GUITION factory docs: spec PDF, IO pin distribution xlsx, Arduino demos).

Board variants: JC4827W543N (no touch), ...R (resistive XPT2046), ...C (capacitive GT911). Ours is the C model.

1. Vendor-documented pin allocation (authoritative)

From 5-IO pin distribution/4.3 inches IO pin distribution.xlsx, cross-checked against the demo sketches (1-Demo/Demo_Arduino/3_3-* and 4_*):

GPIO Vendor function Notes
0 BOOT button also wired to LCD_TE
1 BL_CTRL LCD backlight
2 SPECK_LRCLK onboard speaker amp I2S WS
3 CTP_INT / RTP_IRQ touch interrupt (both models)
4 CTP_SCL GT911 I2C SCL
5 free P2 header (IO46/9/14/5)
6 free P3 header (IO6/7/15/16)
7 free P3 header (IO6/7/15/16)
8 CTP_SDA GT911 I2C SDA
9 free P2 header (IO46/9/14/5)
10 TF_CS microSD slot
11 RTP_DIN / TF_MISO shared SPI: resistive touch / SD
12 RTP_CLK / TF_CLK shared SPI
13 RTP_DIO / TF_MOSI shared SPI
14 free P2 header (IO46/9/14/5)
15 free P3 header (IO6/7/15/16)
16 free P3 header (IO6/7/15/16); used by vendor LED demo
17 U1TXD P4 header (GND/3V3/17/18), usable if UART1 unused
18 U1RXD P4 header (GND/3V3/17/18), usable if UART1 unused
19 USB+ USB D+
20 USB- USB D-
21 LCD_A0 QSPI data 0
22–25 — do not exist on ESP32-S3
26–34 — flash/PSRAM or non-existent
35 not available octal PSRAM (xlsx marks explicitly)
36, 37 free per xlsx but consumed by octal PSRAM on N8R8/R8 modules — treat as unavailable until module variant confirmed
38 RTP_CS (resistive model) on the C model this is the GT911 reset line — see §3
39 LCD_A3 QSPI data 3
40 LCD_A2 QSPI data 2
41 SPECK_DIN speaker amp I2S data in
42 SPECK_BCLK speaker amp I2S BCLK
43 U0TXD console
44 U0RXD console
45 LCD_CS QSPI chip select
46 free per xlsx P2 header; strapping pin (LOG), input-only on ESP32-S3 — never an output
47 LCD_CLK QSPI clock
48 LCD_A1 QSPI data 1

The board carries an onboard I2S speaker amplifier (datasheets for NS4168 / AX9835 ship in 4-Driver_IC_Data_Sheet), a Speak connector (P7), BAT connector (P6), TF slot, UART0 console, and free-IO headers: P2 exposes IO46/9/14/5, P3 exposes IO6/7/15/16, and P4 is GND/3V3/17/18 (the UART1 header). Vendor demos drive LEDs on GPIO 16/17 and a DHT11 on GPIO 27 — note GPIO 27 is not in the vendor pin table, so that demo value is suspect/generic.

2. What the code assigns today

board_jc4827w543 (components/board_jc4827w543/board.c)

Signal Code GPIO Vendor Match
LCD CS 45 45 LCD_CS yes
LCD SCK 47 47 LCD_CLK yes
LCD D0 21 21 LCD_A0 yes
LCD D1 48 48 LCD_A1 yes
LCD D2 40 40 LCD_A2 yes
LCD D3 39 39 LCD_A3 yes
LCD BL 1 1 BL_CTRL yes
TP SDA 8 8 CTP_SDA yes
TP SCL 4 4 CTP_SCL yes
TP INT 3 3 CTP_INT yes
TP RST 38 38 (demo: TOUCH_RES 38) yes — see §3
Motor EN 7 7 free (P3) yes — locked
Motor STEP 16 16 free (P3) yes — locked
Motor DIR 15 15 free (P3) yes — locked
DS18B20 temp 17 17 U1TXD (P4) yes — UART1 unused
Speaker BCLK 42 42 SPECK_BCLK yes
Speaker LRCLK 2 2 SPECK_LRCLK yes
Speaker DIN 41 41 SPECK_DIN yes

hal_display_nv3041a.c

Driver NV3041A over QSPI via esp_lcd SPI host, 480×272, quad mode, 40 MHz. Matches the vendor demo (Arduino_ESP32QSPI(45,47,21,48,40,39) + Arduino_NV3041A, Arduino_Canvas(480,272)).

Caveat: the spec sheet PDF lists the driver chip as "ST3401A" — that string appears nowhere else; every demo and the burn files use NV3041A. Treat the PDF label as a typo.

hal_input_gt911.c

GT911 at I2C addr 0x5D (GT911_SLAVE_ADDRESS1 in the vendor touch.h), I2C_NUM_0 @ 400 kHz on SDA 8 / SCL 4. Reset sequence (drive INT low, pulse RST, release INT to input) selects the 0x5D address per the GT911 datasheet — matches the vendor demo's TOUCH_RES 38 / TOUCH_INT 3 wiring.

board_wroom + hal_* (classic ESP32, unchanged)

Signal GPIO Source
Stepper STEP 12 config.h, hal_motor.c
Stepper DIR 14 config.h, hal_motor.c
Stepper EN (active LOW) 27 config.h, hal_motor.c, board_wroom
DS18B20 13 config.h, hal_temp.c
Beeper 25 config.cpp, hal_audio.c
LCD 2004 I2C SDA 21 / SCL 22, addr 0x27 config.cpp, hal_display_lcd2004.c
Keypad rows 19, 18, 5, 17, 16 config.cpp, hal_input_keypad.c
Keypad cols 15, 2, 0, 4 config.cpp, hal_input_keypad.c

Self-consistent with docs/CURRENT_STATE.md. Not related to the S3 panel.

3. Findings / discrepancies

  1. Display and touch pins are all correct. Every QSPI, backlight and GT911 pin in board_jc4827w543/board.c matches both the vendor xlsx and the vendor Arduino demos. No changes needed.

  2. TP_RST on GPIO 38 is undocumented for the C model. The xlsx labels IO38 RTP_CS (its resistive-touch function). The capacitive demos (LvglWidgets/touch.h) set TOUCH_RES 38, so on the C variant IO38 is clearly the GT911 reset. Our code is right, but the vendor table alone would not tell you that — the demo code is the authority here.

  3. Motor EN/STEP/DIR and DS18B20 are now locked on the S3 board. Header labels confirmed: P2 exposes IO46/9/14/5, P3 exposes IO6/7/15/16, P4 is GND/3V3/17/18 (the UART1 header).

    • Motor STEP 16, DIR 15, EN 7 (active LOW) — all on P3; IO6 stays spare.
    • DS18B20 on 17 — P4 puts GND, 3V3 and data on one header; UART1 is unused.
    • Speaker amp I2S stays on the vendor pins: BCLK 42, LRCLK 2, DIN 41 (P7 Speak).
    • Avoid: 0 (BOOT/LCD_TE), 1–4/8 (LCD+touch+speaker), 10–13 (TF/RTP SPI), 19/20 (USB), 21 (LCD D0), 35–37 (octal PSRAM), 38–48 (used/strapping), 43/44 (console).
    • GPIO 46 is xlsx-free and on P2 but is input-only on the ESP32-S3 — never use it for outputs.
    • Octal PSRAM (sdkconfig.s3: CONFIG_SPIRAM_MODE_OCT=y) means 33–37 are off-limits even though the xlsx only flags 35.
  4. Audio on S3 should use I2S, not a beeper GPIO. The board has a speaker amp on IO2 (LRCLK), IO41 (DIN), IO42 (BCLK) — P7 Speak connector. hal_audio currently builds the LEDC buzzer only for esp32 and a stub elsewhere; an S3 implementation should drive I2S on those pins rather than allocating a GPIO.

  5. DS18B20 on S3 needs one free GPIO (any of §3's candidates; it only needs input+open-drain drive). Hal currently stubs temp on non-esp32.

  6. Reserved/bus-shared notes: GPIO 0 carries LCD_TE in addition to BOOT — do not use it for anything else. TF card SPI (10–13) is shared with resistive-touch signals on R models; on our C model it's purely the SD slot.

  7. No conflicts found between the code's S3 selections and the vendor map — every consumed pin is one the vendor assigns to that same function.

Motor / temp / speaker wiring as locked (phase I01)

Signal GPIO Rationale
STEP 16 free, P3 header, no boot function
DIR 15 free, P3 header
EN (active LOW) 7 free, P3 header
DS18B20 17 P4 header carries GND/3V3/17/18 — one connector for the sensor
Speaker BCLK / LRCLK / DIN 42 / 2 / 41 onboard amp wired to P7 Speak

Keep motor EN's disable-first behaviour (drive inactive at boot before enabling output mode).