Skip to content

Keep unknown chips off the ESP32 board tables and let the driver own the I2S clock where the raw divider is unverified - #378

Merged
lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:board_tables_unknown_chips
Sep 22, 2026
Merged

lovyan03 merged 1 commit into
m5stack:developfrom
ainyan03:board_tables_unknown_chips

Conversation

@ainyan03

Copy link
Copy Markdown
Contributor

Summary

Two places selected code by chip name and let unknown chips fall through to the ESP32 branch:

  • Pin tables: a chip that none of the seven tables name landed on the ESP32 rows. A new target with enough GPIOs (ESP32-S31 / H4, ESP-IDF 6.1 preview) compiled and then probed the ESP32 I2C pins as board_unknown; one with fewer (ESP32-H21) failed to compile. The tables now name the ESP32 branch and end in the sentinel row for anything else. The ESP32-C2, which has no board, moves from the ESP32 rows to the sentinel as well.
  • I2S clock: the driver configuration asked for I2S_CLK_SRC_PLL_160M except on H2 / P4. It now asks for I2S_CLK_SRC_DEFAULT everywhere — on every chip whose raw divider path runs it is that same PLL_160M source, so nothing changes on the existing targets. The raw clock divider the speaker / mic tasks write afterwards depends on a per-chip source frequency (M5UNIFIED_I2S_PLL_D2_HZ) that cannot be derived from a capability macro, so it is defined only for the targets it was verified on; any other chip takes the driver-managed path the ESP32-P4 already uses (real rate passed at setup, no raw override, the over-sampled rate for PDM capture) instead of assuming 80 MHz. The unverified H4 entry is dropped from that table.

With the matching M5GFX change (m5stack/M5GFX#302), ESP32-S31 and ESP32-H21 build.

Verification

  • Builds: Arduino core 3.1.1 / 2.0.17 / 3.3 (C5), ESP-IDF 5.1 / 5.2 / 5.3 / 5.5 (incl. C61) / 6.0 — the CI matrix, all clean; ESP-IDF 6.1 preview for ESP32-S31 and ESP32-H21.
  • Hardware, unchanged behaviour: ESP32 (Core Basic / Tough / Core2 ×5), ESP32-S3 (CoreS3 / StopWatch), ESP32-C5 (Tough C5), ESP32-C61 (CoreMatrix), ESP32-P4 (Tab5) — board detection, I2C scan, speaker play / stop and mic recording.
  • Fork CI green before submitting.

…the I2S clock where the raw divider is unverified

A chip that none of the pin tables name fell through to the ESP32 rows, so a
new target with enough GPIOs (ESP32-S31, H4) compiled and then probed the
ESP32 I2C pins as board_unknown, while one with fewer (H21) failed to
compile. The seven tables now name the ESP32 branch and end in the sentinel
row for anything else. (The ESP32-C2, which has no board, moves from the
ESP32 rows to the sentinel as well.)

The I2S driver configuration asks for I2S_CLK_SRC_DEFAULT everywhere: on
every chip whose raw divider path runs it is the PLL_160M source that path
expects, so nothing changes on the existing targets, and a chip without it
no longer needs naming. The raw clock divider that the speaker and mic tasks
write afterwards depends on a per-chip source frequency
(M5UNIFIED_I2S_PLL_D2_HZ) that cannot be derived from a capability macro, so
it is defined only for the targets it has been verified on; any other chip
takes the driver-managed path that the ESP32-P4 already uses (real rate
passed at setup, no raw override, the over-sampled rate for PDM capture)
instead of guessing 80 MHz. The unverified H4 entry is dropped from the
table for the same reason.

Together with the matching M5GFX change, ESP32-S31 and ESP32-H21 (ESP-IDF
6.1 preview) build; the existing targets keep their code paths.
@lovyan03
lovyan03 merged commit 50d6fd8 into m5stack:develop Sep 22, 2026
28 checks passed
@ainyan03
ainyan03 deleted the board_tables_unknown_chips branch September 22, 2026 04:07
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.

2 participants