PDM support on Micropython

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
Posts: 6
Joined: Mon Oct 22, 2018 6:16 pm

PDM support on Micropython

Post by CharlesFr » Thu Mar 19, 2020 4:52 pm


I would like to know if there is a PDM support for my Micropython Board ?
It's for MEMS Microphone.

Someone can help me ?

User avatar
Posts: 1440
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia

Re: PDM support on Micropython

Post by jimmo » Fri Mar 20, 2020 2:44 am

I took a quick look out of curiosity.

On STM32, some of the newer families (L4, H7, possibly others) have a DFSDM peripheral -- so you do the whole thing in hardware and just get a PCM stream out of it. (This peripheral is not currently supported in MicroPython... you could try and poke the registers directly, but it involves setting up DMA etc...not easy)

But PDM is synchronous serial, so if you're prepared to do the delta-sigma demodulation (i.e. pulse density) yourself, then you can read data from it directly using SPI (or I2S). It's just not going to be possible to get continuous audio without again doing DMA etc as you'll be alternating between requesting SPI data then processing it. DMA is definitely on the TODO list for MicroPython's SPI driver but not currently supported.

Post Reply