← index #18192PR #14176
Related · high · value 1.721
QUERY · ISSUE

zephyr: Add PDM microphone support

openby bikeNomadopened 2025-10-02updated 2025-10-22
enhancementport-zephyr

Description

There has been discussion about adding PDM microphone support to the ESP32 I2S driver (#14176 ).

Seeed Studio have written a basic PDM driver for Zephyr: https://github.com/Seeed-Studio/micropython-seeed-boards/blob/master/src/cmodules/modpdm/modpdm.c

This PDM class is not related to I2S (though of course some ports may use I2S hardware to support PDM microphones).

It currently implements a blocking read that returns a bytearray, but would be more useful with asyncio support (like machine.I2S).

Code Size

This can be optionally enabled with CONFIG_AUDIO, CONFIG_AUDIO_DMIC, and CONFIG_AUDIO_DMIC_NRFX_PDM (for the NRF parts), as well as enabling the PDM peripheral in the devicetree overlay file.

I'd be willing to bring their code over to test, but may need some help with adding the asyncio support.

Implementation

I intend to implement this feature and would submit a Pull Request if desirable

Code of Conduct

Yes, I agree

CANDIDATE · PULL REQUEST

ports/esp32: Add PDM RX feature to I2S.

openby Lana-chanopened 2024-03-25updated 2025-10-02
port-esp32

hello! i hope this PR meets the code conventions guidelines. i've tried running the code auto-formatter but it tried to modify some 50 unrelated files instead. please let me know what i can change if this PR is unacceptable.

this PR adds the capability to grab samples from PDM devices (such as certain MEMS microphones) to the ESP32 port using the new ESP-IDF PDM driver. i have tested this on an M5 Cardputer which has a SPM1423 microphone built-in. i have tested that other I2S functions are unaffected (the cardputer also has a NS4168 speaker i have been using). i have also confirmed that other ports which use machine.I2S (rp2, mimxrt, stm32) have compilation unaffected, however i do not have those boards to test physically.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied