This blog is to describe how to add the PDM Microphone on Nordic nRF52 Series.
The PDM is started to support on the nRF52832.
The pulse density modulation (PDM) module enables input of pulse density modulated signals from external audio frontends, for example, digital microphones. The PDM module generates the PDM clock and supports single-channel or dual-channel (Left and Right) data input. Data is transferred directly to RAM buffers using EasyDMA.
Listed here are the main features for PDM:
• Up to two PDM microphones configured as a Left/Right pair using the same data input
• 16 kHz output sample rate, 16-bit samples
• EasyDMA support for sample buffering
• HW decimation filters
Adafruit PDM Microphone
PDM is a little like 1-bit PWM. You clock the mic with a 1 MHz – 3 MHz clock rate, and on the data line you’ll get a square wave out that syncs with the clock. The data line with be 0 or 1 logic output, with the square wave creating a density that when averaged will result in the analog value out.
These mics are very simple!
- 3V – This is the power input pin, this powers the chip directly. Use a quiet power supply pin if available. (The chip supports 1.8-3.3V but we have not tested it at 1.8V)
- GND – Power and data ground reference
- SEL – Left/Right select. If this pin is high, the output is on the falling edge of CLK considered the ‘Right’ channel. If this pin is low, the output is on the rising edge, a.k.a ‘Left’ channel.
- CLK – PDM clock in, 1 – 3 MHz square wave required
- DAT – PDM data out.
Connection between nRF52840 and PDM
Connection Adafruit PDM with nRF52840 DK Board
- P0.02 — Use the GPIO Output as the VDD for the PDM board
- P1.15 — SEL (Connect to the GND)
- P1.14 — CLOCK of the PDM
- P1.13 — DATA out of the PDM
Here are the example code (Based on nRF52 SDK 16.0)
Initialize the PDM module
Enable / Disable the PDM
Callback of the PDM handler
PDM Buffer by using the balloc
By using the Logic Analyzer to monitor the PDM CLK and PDM DATA OUT