fix(esp_board_manager): gate PDM RX HP-filter fields on chip cap (AUD-7249) - #45
Open
PascalAI2024 wants to merge 1 commit into
Open
fix(esp_board_manager): gate PDM RX HP-filter fields on chip cap (AUD-7249)#45PascalAI2024 wants to merge 1 commit into
PascalAI2024 wants to merge 1 commit into
Conversation
The PDM RX slot codegen emits `hp_en`, `hp_cut_off_freq_hz`, and
`amplify_num` for any chip with SOC_I2S_HW_VERSION_2, but these struct
fields are gated by SOC_I2S_SUPPORTS_PDM_RX_HP_FILTER, which is currently
only set on ESP32-P4. ESP32-S3 has HW_VERSION_2 but lacks the cap, so
builds fail with:
error: 'i2s_pdm_rx_slot_config_t' has no member named 'hp_en'
Restrict the emission to chips that actually support the cap.
Verified on real hardware: a Seeed XIAO ESP32-S3 Sense board adaptation
compiles, flashes, and boots — PDM mic comes up at 16 kHz mono.
Refs: espressif#44
Contributor
|
Processing this fix. The issue will be fixed in v0.5.10. |
Contributor
|
This fix has now been included in v0.5.10. Thanks again for the contribution and testing! Also, esp_board_manager now has a standalone repository. Feel free to report future issues or submit PRs there: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #44.
Bug
packages/esp_board_manager/peripherals/periph_i2s/periph_i2s.py::build_pdm_rx_slot_config()emitshp_en,hp_cut_off_freq_hz, andamplify_numfor any chip withSOC_I2S_HW_VERSION_2. On ESP32-S3, the generated init code fails to compile:Root cause
In ESP-IDF
components/esp_driver_i2s/include/driver/i2s_pdm.h, those three struct fields are gated by a separate cap, not by HW version:Wait — actually they sit under
SOC_I2S_SUPPORTS_PDM_RX_HP_FILTERin current IDF. Either way the relevant cap isSOC_I2S_SUPPORTS_PDM_RX_HP_FILTER, which is currently only set on ESP32-P4 (components/soc/esp32p4/include/soc/Kconfig.soc_caps.in). ESP32-S3 isSOC_I2S_HW_VERSION_2 == 1butSOC_I2S_SUPPORTS_PDM_RX_HP_FILTERis not defined for it, soi2s_pdm_rx_slot_config_thas nohp_enfield on S3 — and the codegen-emitted initializer fails to compile.The Python codegen was using HW version as a proxy for the HP-filter cap, but those two are not equivalent. HW_VERSION_2 chips (S3, C3, C5, C6, C61, H2, H21, H4, P4) is a strict superset of chips with the HP-filter cap (P4 only).
Fix
Restrict emission of
hp_en/hp_cut_off_freq_hz/amplify_numto chips that actually expose the cap. Today that is just ESP32-P4; if a future target also setsSOC_I2S_SUPPORTS_PDM_RX_HP_FILTER, add it to the tuple.ESP32 / ESP32-S2 (HW_VERSION_1) are unaffected — they never entered the branch. ESP32-P4 is unaffected — it still gets the fields. ESP32-S3 / C3 / C5 / C6 / C61 / H2 / H21 / H4 stop emitting the fields they don't have, fixing the build.
Verification
Verified hardware: Seeed XIAO ESP32-S3 Sense, ESP32-S3R8, IDF v5.5.4-299-ge46782886f.
After the patch, the generated
audio_board_init.ccompiles, the firmware flashes, and the PDM mic comes up at 16 kHz mono on real silicon.Test plan
esp32p4remains in the gate tuple)