Trouble with INMP441 microphone with SAI configuration

I’m connecting an INMP441-based MEMS microphone module to the Daisy Seed via SAI_2.
I’m hearing loud digital noise on top of the microphone’s sound, which itself also sounds glitchy. Strangely, it works with both SAI_32BIT and SAI_16BIT, but not with SAI_24BIT. The nature of the noise changes, but the overall issue remains the same. I’ve tried all sample rate and block size settings, different microphones from different batches, adding capasitors on power side, dedicated power supply for mic module, and even tried it on another Daisy – the problem persists.

Here is my text code:

#include "daisy_seed.h"
#include "daisysp.h"

using namespace daisy;
using namespace daisysp;

DaisySeed hw;
Svf      filt_low;
Svf      filt_high;

void AudioCallback(AudioHandle::InputBuffer   in, AudioHandle::OutputBuffer  out, size_t size)
{
	for (size_t i = 0; i < size; i++)
	{
		float input = in[2][i];

		if(input > 0.95f) input = 0.95f;
		if(input < -0.95f) input = -0.95f;
        
		out[0][i] =  out[1][i] = input;
		}
}


int main(void)
{
	hw.Init();
	hw.Configure();

	SaiHandle         sai_handle;
	SaiHandle::Config sai_cfg;

	sai_cfg.periph = SaiHandle::Config::Peripheral::SAI_2;
	sai_cfg.sr = SaiHandle::Config::SampleRate::SAI_96KHZ;
	sai_cfg.bit_depth = SaiHandle::Config::BitDepth::SAI_32BIT;
	sai_cfg.b_sync = SaiHandle::Config::Sync::MASTER;
	sai_cfg.b_dir = SaiHandle::Config::Direction::RECEIVE;

	sai_cfg.pin_config.fs = seed::D27;
	sai_cfg.pin_config.sck = seed::D28;
	sai_cfg.pin_config.sb = seed::D25;

	sai_handle.Init(sai_cfg);

	AudioHandle::Config audio_cfg;
	audio_cfg.blocksize = 32;
	audio_cfg.samplerate = SaiHandle::Config::SampleRate::SAI_48KHZ;
	audio_cfg.postgain = 0.05f;
	audio_cfg.output_compensation = 0.2f;

	hw.audio_handle.Init(audio_cfg, hw.AudioSaiHandle(), sai_handle);


	hw.StartAudio(AudioCallback);

	while(1) {}
}

There seems to be a problem with the data consistency between Daisy and INMP441.

Any thoughts?

I have no experience with I2S microphones, though I’m pretty sure I have some around here somewhere. EDIT: I found them, so I’ll give them a try here.

Your code shows different sample rates in sai_cfg and audio_cfg. Is that a problem, or you just copied the source code while it was in an in-between state?

I tried different combinations in this place too. Despite the fact sample rates same or different, it sounds a bit different, but problem remains

I’d love to know if you ever get this working! I’m having the exact same issues using the Adafruit ICS43434 I2S Module. I’m using the same pinout as you described above, and my baseline project code is from THIS discussion regarding I2S MEMS example code.

Here’s a basic rundown of things I’ve tried to troubleshoot as much as I can remember (including your bit rate mentions above):

  • Tested both Block A and Block B for Receive/Transmit
  • Verified Callbacks and Clock Signals toggling in the Serial Monitor
  • Measured Voltages on BCLK and LRCL (not stuck high or low)
  • Verified grounding SEL actually puts audio on the Left slot
  • Completely muted Right side (in[3]) in case of any “open” mic or interference there
  • Implemented full scale mic conditioning like EQ, Compression, Limiting etc.
  • Ran a simple tone generator through the same SAI config with no distortion/hiss/digital noise
  • Tested multiple output sources to eliminate acoustic feedback
  • Ran direct through straight to monitor, and even tried recording into the buffer first hoping that stored playback was clean - unfortunately it had the same result.

I’ve tried everything I can think of, but can’t get this Mic to play nicely. I might have to move on to an Electric Mic for now, but hoping someone has a solution since the I2S is pretty great for the straightforward set up. Using the Analog Electret will require a bit more circuitry for the preamp etc.

Good Luck! Be in touch if you get anywhere on this.

1 Like

For now i also use Analog mic. In a couple of weeks I’ll receive a pair of microphones of a different type, I’ll tell you what happened!

I’ve used logic analyser and signal looks like ok, exept i see in SCK channel 16 pulses for SAI_16BIT BitDepth setting, 32 for SAI_32BIT, but for SAI_24BIT i see 32 pulses, not 24. But i was told that it is normal.

I posted on Daisy discord server in #harware channel, and there is some information also.

I’ve tried SPH0645 and ICS-43434 mic’s. With SPH0645 i saw no signs of life, with ICS-43434 i hear high pitch whistle. On logic analyser there is almost normal pictrue, but no from mic, even distorted.
Only with INMP441 i heared some sound.

Picture from ICS-43434 data. SCK, FS, SD B pins