Hi,
I can't seem to find any (useful) documentation / examples for using I2S over the SAI on the FRDM-MCXN947. The implementation I would like to use it for is to retrieve audio data from an single external MEMS microphone SPH0645LM4H), to store it into a buffer and eventually run it across a machine learning model to recognise patterns.
Now, I was able to find a few examples regarding the EDMA, but sadly those are only made for the other communication protocols.
Any documentation or examples would be a great help! Also if they are examples for very similar microcontrollers. Thanks in advance!
Colin
Hi,
The PDM Microphone Interface (MICFIL) is an independent module, it is nothing to do with SAI.
Of course, you can read the audio data from the Microphone Interface and save the audio sample to a buffer without SAI involvement.
This is SDK example, which demos how to configure PDM and save audio sample to buffer
Pls download SDK based on MCXN family.
https://mcuxpresso.nxp.com/en/welcome
Then load the PDM interrupt example.
Hope it can help you
BR
Xiangjun Rong
Thanks for the reply! For the last hours I've been trying to get the example "pdm_edma_transfer" to work, but I just can't get my head around something.
When opening the pins viewer from ConfigTools, I see that PDM0_DATA0 has P0_17/J7 as label, and PDM0_CLK P0_16/J7 (see image below).
Using these connections to wire up my microphone, the output seen in console stays the same whether the microphone is connected or not (output in image below).
Now, when I take a look at the schematics of the board, PDM0_DATA0 should correspond with GPIO: P0_5 (pin 4 of PMOD header) and PDM0_CLK with GPIO: P0_4 (pin 6 of PMOD header). Both these pins appear not to be connected by default, so SJ12 and SJ13 have to be changed by soldering.
Please explain why the pin viewer from ConfigTools shows me different pins, which to use and how to properly use them.
Kind regards,
Colin
Hi,
For the SDK example, it uses the P0_16 as PDM0_CLK, P0_17 as PDM0_DATA0.
For each Microphone, it has SEL pin to select the channel, which control the the data is valid on the rising edge or
falling edge of the CLK.
Pls connect a scope and check the clk and data signal.
Hope it can help you
BR
Xiangjun Rong
Connected a scope on CLK (CH1) and DATA (CH2) lines which both appear to be normal, see attached:
But the output of my terminal remains the same whether I connect the PDM microphone or not... Just can't figure out what I'm missing. Why are the values to high, and why won't they change?
Hi,
Each CLK/DATA corresponds to one audio channels, the CLK rising edge of CLK latches channel_0, the falling edge of CLK latches channel_1.
If you want to get two channel samples, you have to use two DMIC device, the two devices share the CLK and DAT pins, but one SEL pin is connected to high, another SEL pin is connected to low.
Because you use only one DMIC, so you can only get one channel data.
Hope it is helpful.
BR
XiangJun Rong