0

I have been playing around with some digital microphones, which have an I2S interface. I managed to get it working (Arduino board with small I2S mems board). At least, I think I did.

When reading the I2S specification, or the microphone datasheet, I can not seem to find the answer to the following simple questions; 1. What do the digital values represent? 2. How do you convert the digital values to dbFS (and then later an dbSPL)?

The SPH0645LM4H-B (Knowles) microphone seems to output all negative values (?). I read somewhere you have to "subtract the midpoint" to eliminate the large DC offset etc. (See here: Convert Digital and Analog values to dB SPL ) On the other hand, a support engineer at Invensense explained to me that the ICS-43434 outputs positive and negative values which "represent the amplitude of the signal relative to +/-full scale".

I expected I2S to be a standard; isn't that the case ... ?

  • I2S is a standard, yes. The digital values simply represent digitised audio in the form of a PCM stream. Are you actually getting real data from the microphone or just a constant string of 1s? – Finbarr Nov 07 '17 at 10:48
  • I configured the I2S bus to sample at 16kHz, and I do read out values; however, they are always negative; they do represent actual audio values because they fluctuate based on the sound I create. Using the calculation suggested in the link I mentioned, I can perfectly calculate dbFS (and thus dbSPL), and they do change based on sound I create next to microphone. Perhaps, I did not ask my question clearly; I would like to know what do the values really represent? (I know audio, but in which type of units? pressure values?) – Salvatore Castellano Nov 08 '17 at 17:36
  • Also, why are ALL the output values negative values? As I mentioned, a support engineer at Invensense told me that the digital microphone outputs positive and negative values relative to +/- full scale (around zero); which honestly I was expecting. However, I see clearly different behaviour with the SPH0645LM4H-B. ( I get similar results as shown in https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/arduino-wiring-and-test ) => this example also outputs only negative values... – Salvatore Castellano Nov 08 '17 at 17:36
  • In the Adafruit example they are normalizing the received data to center it around 0. Maybe this is something to look into. – Catsunami Jan 31 '18 at 17:13
  • I'm voting to close this question as unanswerable because no detail as provided to indicate what the asker considers a negative value to be, for example they claim to have looked with a scope but do not include a scope picture in the question. Further, the question appears to say that I2S is being interfaced to an Arduino but later in a comment it is stated that it is being received by a CC3220. – Chris Stratton Mar 04 '18 at 19:13
  • 1
    Just because you don't know the answer, doesn't mean the question is unanswerable, is it? FYI, I have used a breakout board with a SPH0645LM4H mounted on, as well as an evaluation board with an ICS-43434 on it. I have used them on an Arduino board and on the CC3220S evaluation board. The results were the same; the values I read were negative numbers. Similar results were described in the link I mentioned. I thought my questions were clear, which they apparently are not. 1. What do the digital values represent? 2. How do you convert the digital values to dbFS (and then later an dbSPL)? – Salvatore Castellano Mar 05 '18 at 21:23
  • In the case it helps to anyone, the proper scope picture is on my question at https://electronics.stackexchange.com/q/518366/138929 – EmbeddedGuy Aug 30 '20 at 09:32
  • @salvatore: I have the same question, see above. Did you figure out the values? – EmbeddedGuy Aug 31 '20 at 10:15
  • @EmbeddedGuy Well, yes and no. In the end, for my application I wanted to measure the dBSPL. Based on input from several people, I ended up takes x samples for a timeframe of 1 sec. Then, I calculated the average, and substracted (normalized) the x samples with this average. Then, I calculated the RMS value of this sample (from now on, the negative sign did not matter anymore btw). The resulting value needs to be substracted from 120; this gave me good results. Hope this helps you. – Salvatore Castellano Aug 31 '20 at 17:59
  • @Salvatore, thank you. I finally figured it out: https://electronics.stackexchange.com/a/519223/138929 – EmbeddedGuy Aug 31 '20 at 21:13

2 Answers2

2

I would bet that your I2S receiver is incorrectly configured, I2S has a rather weird one clock offset compared to the other common formats, and if you get this wrong you will always see a 1 in the MSB of the recovered sample which causes everything to appear negative if interpreted as a signed value.

Check your programming of the port against the timing diagrams for I2S, my bet is you are set up for right justified not I2S.

Getting the sign extension right for this can also be 'interesting'.

The units are either pressure or velocity (depending on which type of microphone element) relative to some slowly filtered baseline pressure. Scale depends on sensitivity.

Dan Mills
  • 17,266
  • 1
  • 20
  • 38
  • I used a scope to verify the signals, and it still looks as if all the values are negative. On the other hand, the I2S receiver is a HW implemented one (inside a TI CC3220); timings should be implemented as specified in the standard. – Salvatore Castellano Nov 14 '17 at 08:17
0

The microphone outputs in 2's compliment as it says on the data sheet so my assumption is the ADC puts data on a scale from 1-2^18 and then converts them to 2's compliment, which is all negative.

  • 1
    2's complement is not all negative. All numbers from 0 to 2^(N-1) are positive, only when MSB is set the number is interpreted as negative. – jusaca Apr 02 '20 at 06:51