fix(audioreactive): skip i2s_set_clk() for PDM mode on IDF 5.x - #5807
fix(audioreactive): skip i2s_set_clk() for PDM mode on IDF 5.x#5807aenertia wants to merge 1 commit into
Conversation
i2s_set_clk() after i2s_driver_install() kills PDM mode on ESP-IDF 5.x, producing all-zero samples from the microphone. The PDM clock is configured during driver install; calling i2s_set_clk() afterwards resets it to I2S standard mode. Fix: guard i2s_set_clk() with if (!(_config.mode & I2S_MODE_PDM)) so PDM microphones (SPM1423, INMP441 in PDM mode) work correctly on IDF 5.x. Also fixes PDM channel format: uses I2S_CHANNEL_FMT_ALL_LEFT/ALL_RIGHT instead of ONLY_LEFT/ONLY_RIGHT, which is required for PDM compatibility on IDF 5.x (ONLY_* variants produce silence in PDM mode). Tested on M5StickC with SPM1423 PDM microphone.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. WalkthroughPDM channel selection now uses side-specific ChangesPDM I2S configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The PR makes a localized audio-source change to preserve PDM microphone operation on ESP-IDF 5.x, with no actionable merge-blocking risk remaining beyond normal checks and review. Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
i2s_set_clk() after i2s_driver_install() kills PDM mode on ESP-IDF 5.x, producing all-zero samples from the microphone. The PDM clock is configured during driver install; calling i2s_set_clk() afterwards resets it to I2S standard mode.
Fix: guard i2s_set_clk() with if (!(_config.mode & I2S_MODE_PDM)) so PDM microphones (SPM1423, INMP441 in PDM mode) work correctly on IDF 5.x.
Also fixes PDM channel format: uses I2S_CHANNEL_FMT_ALL_LEFT/ALL_RIGHT instead of ONLY_LEFT/ONLY_RIGHT, which is required for PDM compatibility on IDF 5.x (ONLY_* variants produce silence in PDM mode).
Tested on M5StickC with SPM1423 PDM microphone.
Summary by CodeRabbit