Documentation / examples for I2S over SAI on the FRDM-MCXN947

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Documentation / examples for I2S over SAI on the FRDM-MCXN947

513 Views
Verspecke
Contributor I

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. And since yet I'm not really familiar with I2S, SAI and this microcontroller, I was hoping that anyone has already got something familiar working. 

Any documentation or examples would be a great help! Also if they are examples for very similar microcontrollers. Thanks in advance!

Colin

Labels (1)
0 Kudos
Reply
5 Replies

488 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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.

xiangjun_rong_0-1729652837589.png

 

Hope it can help you

BR

Xiangjun Rong

 

0 Kudos
Reply

466 Views
Verspecke
Contributor I

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).

Screenshot 2024-10-23 at 20.11.37.png

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).

PDM_Interrupt (not connected).png

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.

Screenshot 2024-10-23 at 20.18.22.png

Please explain why the pin viewer from ConfigTools shows me different pins, which to use and how to properly use them.

Kind regards,

Colin

0 Kudos
Reply

452 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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

xiangjun_rong_0-1729736195555.png

 

0 Kudos
Reply

376 Views
Verspecke
Contributor I

Connected a scope on CLK (CH1) and DATA (CH2) lines which both appear to be normal, see attached:

SDS804X_HD_PNG_1.png

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?

Screenshot 2024-11-04 at 16.42.46.png

0 Kudos
Reply

363 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

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.

 

 

xiangjun_rong_0-1730774918511.png

Hope it is helpful.

BR

XiangJun Rong

 

 

0 Kudos
Reply