This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

I2S 32-bit word size

Hello,

I am struggling with interfacing an I2S digital microphone to the nRF52. To be more concrete, it is the Knowles SPH0645LM4H-B. I connected it as suggested in this thread. In the data sheet of the microphone it says:

The SPH0645LM4H microphone operates as an I2S slave. The master must provide the BCLK and WS signals. The Over Sampling Rate is fixed at 64 therefore the WS signal must be BCLK/64 and synchronized to the BCLK. Clock frequencies from 2.048Mhz to 4.096MHz are supported so sampling rates from 32KHz to 64KHz can be had by changing the clock frequency. The Data Format is I2S, 24 bit, 2’s compliment, MSB first. The Data Precision is 18 bits, unused bits are zeros.

I find this contradictory with the figure also provided in the data sheet of the microphone:

image description

In the image it is clear to see that WS toggles first after 32 clocks, which -for me- means, the word size is 32 bits (18 bits data, 6 bits set to 0, and 8 further bits floating).

The problem is that the nRF52's I2S interface does not support 32-bit word size.

/**
 * @brief I2S sample widths.
 */
typedef enum
{
    NRF_I2S_SWIDTH_8BIT  = I2S_CONFIG_SWIDTH_SWIDTH_8Bit,  ///< 8 bit.
    NRF_I2S_SWIDTH_16BIT = I2S_CONFIG_SWIDTH_SWIDTH_16Bit, ///< 16 bit.
    NRF_I2S_SWIDTH_24BIT = I2S_CONFIG_SWIDTH_SWIDTH_24Bit,  ///< 24 bit.
} nrf_i2s_swidth_t;

No matter what settings I try with the available 8, 16, or 24 bit word-size, I can't get all the relevant data bits from the microphone's data stream.

Any ideas how to solve this problem? Or are these two components (nRF52 and Knowles mic) simply incompatible?

Thank you in advance! NewtoM

Parents
  • Hi NewtoM,

    In I2S-master mode, there are restrictions on the sample width (taken from the nRF52832 I2S spec):

    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 nRF52832 can accept 24 bits in 32 bit sample width if it is in I2S-slave mode, but not in master mode.

    However: Are you sure that this sensor assumes 32 bit sample width? The datasheet states that it support 24 bits I2S, and the figure that you posted is the only place it mentions 32 bits. Have you verified this with the component manufacturer?

    Cheers, Håkon

  • Hi Håkon,

    thanks for your reply!

    If I understand you correctly, if I use the nRF52 as I2S slave, I could possibly receive the 24 bits data from the 32 bit sample. The problem is that the I2S microphone does not provide a clock. And even if I would provide the clock from the slave nRF52 (possible, based on the specs), I don't see how I could set it up to provide 32 SCLKs per sample. (That gets back to the problem of missing possibility for using 32 bit word size.)

    As for the reliability of the information, well, the information I showed above is pretty much everything from the data sheet. Should you have some free minutes, have a look: "Knowles SPH0645LM4H-B data sheet". I will try to get in touch with them, too.

    Thanks! NewtoM

Reply
  • Hi Håkon,

    thanks for your reply!

    If I understand you correctly, if I use the nRF52 as I2S slave, I could possibly receive the 24 bits data from the 32 bit sample. The problem is that the I2S microphone does not provide a clock. And even if I would provide the clock from the slave nRF52 (possible, based on the specs), I don't see how I could set it up to provide 32 SCLKs per sample. (That gets back to the problem of missing possibility for using 32 bit word size.)

    As for the reliability of the information, well, the information I showed above is pretty much everything from the data sheet. Should you have some free minutes, have a look: "Knowles SPH0645LM4H-B data sheet". I will try to get in touch with them, too.

    Thanks! NewtoM

Children
No Data
Related