Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

STM32F401RE nucleo board interface with digital MIC with I2s Protocol

Heena09

Junior Member level 2
Junior Member level 2
Joined
Jan 21, 2022
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
162
Hi,

I'm using an STM32F401RE board to connect a CUI device's microphone via the I2S protocol.


The minimum-to-maximum clock requirement for this application ranges from 1 MHz to 3.2 MHz.

However, the nucleo board clock for the i2s using the prescaller in the stm32f401RE is not less than 14.

As a result, I was unable to obtain data from the microphone.

Please guide to set the I2s clock
 

Aussie Susan

Advanced Member level 4
Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,490
Helped
406
Reputation
812
Reaction score
445
Trophy points
1,363
Activity points
17,536
Looking at the data sheet you reference, the data format is '1-bit PDM' and not I2S.
I've not used that myself but it looks like you could use an GPIO pin for the clock of whatever frequency you want and another for the 'data' coming back and then process that as per the PDM (Pulse Density Modulation) process (basically a low pass filter).
(All of the above is just form reading the data sheet and looking a the PDM Wikipedia entry - no experience or practical knowledge is applied.)
Susan
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
51,003
Helped
14,633
Reputation
29,542
Reaction score
13,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,794
Which I2S device are you planning to connect? As explained above, the selected device is not using I2S. To decode PDM you'll probably use a timer in pwm input mode.
 

KlausST

Super Moderator
Staff member
Advanced Member level 7
Joined
Apr 17, 2014
Messages
23,281
Helped
4,742
Reputation
9,505
Reaction score
5,130
Trophy points
1,393
Activity points
154,237
Hi,

As Susan pointed out: the mic interface is not I2S at all.

So why do you still hang on I2S?

Klaus
 

Heena09

Junior Member level 2
Junior Member level 2
Joined
Jan 21, 2022
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
162
Its microphone, which is from CU, was mentioned . which is a PDM microphone. I am using a Nucleo board of type STM32F401 . To receive it, I need to send an audio data from my microphone to HyperTerminal.
Confuse for Clock and interface using which protocol for PDM mic
--- Updated ---

Means i need to interface this mic with PWM pin with clock and with other GPIO pin for data read ?
 
Last edited:

Aussie Susan

Advanced Member level 4
Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,490
Helped
406
Reputation
812
Reaction score
445
Trophy points
1,363
Activity points
17,536
Using PWM for a clock is one way - there are other ways depending on what frequency you intend to use to clock the microphone.
There are other design considerations that you need to make. For example, you say you want to send the audio data to HyperTerminal - how? HyperTerminal is a terminal emulator that is used to display (and enter) characters. How is that expected to display the 'audio data? A fast stream of numbers???
Even before that, the PDM information needs to be converted to analog, or at least an equivalent digitised data stream. Presumably the sampling rate will be related to the microphone clock speed. The PDM stream is simply a stream of 0's and '1' - single bits - that need to be converted to an analog value (as per the Wikipedia article I referred to above) by a LPF. Of course this can be done digitally but you then need to convert the values to digital but the sampling rate can be quite different to the microphone clock rate.
For example, speech via a telephone can be limited to a bandwidth of 300Hz to 3kHz to be understandable. That means a sampling rate of at least 6kHz. On the other hand, CD quality audio is sampled at 44.1kHz.
Then there is the question of how many bits to each sample - 8? 16? 24?
What sampling rate do you intend to use?
Even at 6kHz sampling, and assuming 8 bit samples, that is still approximately 6600 BAUD needed to transfer the values as binary to the HyperTerminal (which may balk at trying to display that). If you try to convert it to a displayable ASCII stream, and assuming 4 characters per sample (3 for the values from 0 to 255 plus a delimiter) that means a transfer rate to the HyperTerminal of greater than 240,000 BAUD. This is certainly achievable but is it what you really want?
Susan
 

FvM

Super Moderator
Staff member
Advanced Member level 7
Joined
Jan 22, 2008
Messages
51,003
Helped
14,633
Reputation
29,542
Reaction score
13,742
Trophy points
1,393
Location
Bochum, Germany
Activity points
291,794
A first order CIC decimation filter can be implemented as counter input that is read out at the decimated sampling frequency.

Unfortunately the microphone data sheet is missing information about the implemented SD modulator characteristics, respectively the effect of different decimation filters on achieved SNR can't be estimated. We can just assume that the specified datasheet SNR uses an optimal FIR decimator which can't be easily implemented in ARM processor. Depending on your requirements you can go for simple 1st order decimator or use a combination of 1st order decimation to 100-200 kHz sampling rate and a software filter.
 

JerryHansen

Newbie
Newbie level 2
Joined
Feb 18, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
10
Using PWM for a clock is one way - there are other ways depending on what frequency you intend to use to clock the microphone.
There are other design considerations that you need to make. For example, you say you want to send the audio data to HyperTerminal - how? HyperTerminal is a terminal emulator that is used to display (and enter) characters. How is that expected to display the 'audio data? A fast stream of numbers???
Even before that, the PDM information needs to be converted to analog, or at least an equivalent digitised data stream. Presumably the sampling rate will be related to the microphone clock speed. The PDM stream is simply a stream of 0's and '1' - single bits - that need to be converted to an analog value (as per the Wikipedia article I referred to above) by a LPF. Of course this can be done digitally but you then need to convert the values to digital but the sampling rate can be quite different to the microphone clock rate.
For example, speech via a telephone can be limited to a bandwidth of 300Hz to 3kHz to be understandable. That means a sampling rate of at least 6kHz. On the other hand, CD quality audio is sampled at 44.1kHz.
Then there is the question of how many bits to each sample - 8? 16? 24?
What sampling rate do you intend to use?
Even at 6kHz sampling, and assuming 8 bit samples, that is still approximately 6600 BAUD needed to transfer the values as binary to the HyperTerminal (which may balk at trying to display that). If you try to convert it to a displayable ASCII stream, and assuming 4 characters per sample (3 for the values from 0 to 255 plus a delimiter) that means a transfer rate to the HyperTerminal of greater than 240,000 BAUD. This is certainly achievable but is it what you really want?
Susan
Thanks for the help, if I face any problem, I will message you.
 

JerryHansen

Newbie
Newbie level 2
Joined
Feb 18, 2023
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
10
Using PWM for a clock is one way - there are other ways depending on what frequency you intend to use to clock the microphone.
There are other design considerations that you need to make. For example, you say you want to send the audio data to HyperTerminal - how? HyperTerminal is a terminal emulator that is used to display (and enter) characters. How is that expected to display the 'audio data? A fast stream of numbers???
Even before that, the PDM information needs to be converted to analog, or at least an equivalent digitised data stream. Presumably the sampling rate will be related to the microphone clock speed. The PDM stream is simply a stream of 0's and '1' - single bits - that need to be converted to an analog value (as per the Wikipedia article I referred to above) by a LPF. Of course this can be done digitally but you then need to convert the values to digital but the sampling rate can be quite different to the microphone clock rate.
For example, speech via a telephone can be limited to a bandwidth of 300Hz to 3kHz to be understandable. That means a sampling rate of at least 6kHz. On the other hand, CD quality audio is sampled at 44.1kHz.
Then there is the question of how many bits to each sample - 8? 16? 24?
What sampling rate do you intend to use?
Even at 6kHz sampling, and assuming 8 bit samples, that is still approximately 6600 BAUD needed to transfer the values as binary to the HyperTerminal (which may balk at trying to display that). If you try to convert it to a displayable ASCII stream, and assuming 4 characters per sample (3 for the values from 0 to 255 plus a delimiter) that means a transfer rate to the HyperTerminal of greater than 240,000 BAUD. This is certainly achievable but is it what you really want?
Susan
My problem is solved :)
 

Aussie Susan

Advanced Member level 4
Advanced Member level 4
Joined
Jan 5, 2015
Messages
1,490
Helped
406
Reputation
812
Reaction score
445
Trophy points
1,363
Activity points
17,536
Jerry - for the sake of others, can you please let us know what you ended up doing?
(Also quoting my entire post - in your previous 2 posts - for a few word comment seems rather pointless, especially as you don't actually reference any part of what I said. Perhaps that is just me!)
Susan
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top