I2S Microphone SPH0645 with the Argon?

Hi guys

Has anybody used an I2S Microphone SPH0645 with the Argon?

This microphone requires an I2S peripheral and won’t work with chips that don’t support it in hardware, I would like to know if it is possible to connect the argon with the microphone using the I2S peripheral.

As I've learned from our Technical Documentation Writer, one basically can't use an I2S MEMS microphone with the nRF52:

Both the SPH0645 and ICS-43432 require a 64X BCK. In other words, 32 cycles of BCK for each phase of WS, to generate 24 bits of sample and 8 bits of padding. Except the nRF52 doesn't support 32-bit mode, it can only use a 48X BCK when using 24-bit mode with no padding on the wire.

1 Like

@marekparticle thanks for your prompt response, now I can understand why the Particle Web IDE shows an error related to the -I2S is not compatible with this board- specifically with nRF52.

1 Like

I'm looking at the datasheet and the nRF52840 supports i2S -https://www.nordicsemi.com/-/media/DocLib/Other/Product_Spec/nRF52840PSv11pdf.pdf

Page 174 -Configure the I2S module using the CONFIG registers

// Enable reception
NRF_I2S->CONFIG.RXEN = (I2S_CONFIG_RXEN_RXEN_Enabled <<
 I2S_CONFIG_RXEN_RXEN_Pos);
// Enable transmission
NRF_I2S->CONFIG.TXEN = (I2S_CONFIG_TXEN_TXEN_Enabled <<
 I2S_CONFIG_TXEN_TXEN_Pos);
// Enable MCK generator
NRF_I2S->CONFIG.MCKEN = (I2S_CONFIG_MCKEN_MCKEN_Enabled <<
 I2S_CONFIG_MCKEN_MCKEN_Pos);
// MCKFREQ = 4 MHz
NRF_I2S->CONFIG.MCKFREQ = I2S_CONFIG_MCKFREQ_MCKFREQ_32MDIV8 <<
 I2S_CONFIG_MCKFREQ_MCKFREQ_Pos;
// Ratio = 256
NRF_I2S->CONFIG.RATIO = I2S_CONFIG_RATIO_RATIO_256X <<
 I2S_CONFIG_RATIO_RATIO_Pos;
// MCKFREQ = 4 MHz and Ratio = 256 gives sample rate = 15.625 ks/s
// Sample width = 16 bit
NRF_I2S->CONFIG.SWIDTH = I2S_CONFIG_SWIDTH_SWIDTH_16Bit <<
 I2S_CONFIG_SWIDTH_SWIDTH_Pos;
// Alignment = Left
NRF_I2S->CONFIG.ALIGN = I2S_CONFIG_ALIGN_ALIGN_Left <<
 I2S_CONFIG_ALIGN_ALIGN_Pos;
// Format = I2S
NRF_I2S->CONFIG.FORMAT = I2S_CONFIG_FORMAT_FORMAT_I2S <<
 I2S_CONFIG_FORMAT_FORMAT_Pos;
// Use stereo
NRF_I2S->CONFIG.CHANNELS = I2S_CONFIG_CHANNELS_CHANNELS_Stereo <<
 I2S_CONFIG_CHANNELS_CHANNELS_Pos;


It just looks like the device OS doesn't expose it yet... maybe a future feature, the phone exposes it so just need to port over the right commands from the datasheet and use those same functions.

You can use I2S directly using the nRF52 SDK on Gen 3 devices without a change in Device OS.

However you still cannot use I2S MEMS microphones that use 32-bit BCK per sample (24 bits of data and 8 bits of padding) because the nRF52 hardware does not support it.

Where did you find that limitation in the nRF data sheet?

I should be more specific: The nRF52 does support 24-in-32, but only in I2S slave mode. But to read from a microphone, you need to be in I2S master mode. There is a technique that involves using two hardware timers to run the nRF52 in I2S slave mode while generating the I2S master timing signals for 24-in-32 but timers are scarce and it seems like a horrible hack.

In the nRF52840 product spec v1.1, p. 167, here's the relevant section:

In Master mode, the size of a half-frame (in number of SCK periods) equals the sample width (in number of bits), and in this case the alignment setting does not care as each half-frame in any case will start with the MSB and end with the LSB of the sample value.
In slave mode, however, the sample width does not need to equal the frame size. This means you might have extra or fewer SCK pulses per half-frame than what the sample width specified in CONFIG.SWIDTH requires.

The size of each half-frame is equal to the sample width in master mode. And the SWIDTH register only has three valid values: 8, 16, and 24. To use a 32-bit per sample SCK, you'd need a value of 32.

I'd be happy to be wrong about that and be able to use an I2S microphone, but I could not find a reasonable way to do it. PDM works great, though.

1 Like

sorry to bring up an old thread, but has anyone used i2S with Particle Argon? Can it be done with Adafruit 3421? Seems like there isn't much out there after searching.

You can't use the Adafruit 3421 (SPH0645) with the Argon or any nRF52840 device. The explanation in the post directly above explains why; the microphone only supports an I2S mode that is not supported on the nRF52840.

Using a PDM digital microphone like the Adafruit 3492 is the best option, and also works on both the Argon and Photon 2. Use the Microphone PDM library.

1 Like