Hi all,
I am trying to accomplish sample audio from a 43434 microphone using a PIC24 MCU and it's somewhat working but I get lots of noise. The PIC MCU (running at 129.042MHz) is providing the microphone with an 1.024MHz signal on SCK and 16kHz on WS. For testing, I am only using the left channel.
In the past, I was using a TI CODE with an analog microphone. The CODEC was tied to a PIC24 MCU. It provided the CODEC with a 3.072MHz master clock (MCLK) and an 128kHz bit clock (BCLK). In return, the CODEC returned an 8kHz WCLK tied to an interruption pin on the MCU. Upon each H-to_L interrupt, the BCLK was read to get 8-bits of data which were then saved to an SD card and all of this works fine.
Using the 43434 MEMS and a logic analyzer, I can clearly see the 1.024MHz and 16kHz signals as well as the audio data on the left channel. As a test to make sure I was sampling correctly, I added a line to my MCU that toggles when it reads bits off the I2S line and what I see when I sample the microphone is that the data out of the mic is the same as how the line toggling performed therefore the MCU seems to be sampling properly.
On top of that to make sure the MCU was able to write to the SD card is that everytime 8-bits of data are read by the MCU, rather than accumulating 24 bits and writing it the card as 3 bytes, instead, the MCU goes go 'round-robin' through letters A-Z and writes these letters rather than the read samples. This resulted in my SD card file to have files filled-up with A-Z A-Z so this means that the MCU and SD card are able to follow-up with the sampling of the audio.
Therefore, when WS goes low and generates a H-to-L interrupt on the PIC MCU, the MCU will skip the first bit as per the specs. Then it will read 24 bits into a buffer and wait until the next WS H-to-L transition occurs. When I start recording, the time it takes for me to count to 5 and stop the recording results in a file containing over 200KB of data.
Using Audacity, I open the file as raw audio chosing 24-BIT signed PCM, 16kHz then a combination of Big Endian, Little Endian, with or without a bit offset. Regardless what I try, the audio is really horrible. I can hear myself counting in the background but it is overlapped with horrible garbage noise.
So this brings me to the following: is it possible that the I2S data does not correspond directly to a PCM sample? For instance, if I have 0x0123 as an I2S audio frame, what would its PCM equivalent be if it was signed PCM 24 bit with the same 16kHz sampling frequency?
Thanks,
Ben
Hello,
Apologies for the delay in responding; thank you very much for your patience while we get this forum up-to-date.
Regarding your question. I'm wondering if you might be able to provide some examples of what results you're seeing. Would you be able to share a copy of the WAV file so that I can hear what your tests are resulting in or the reconstructed samples? Any other data, screenshots from the logic analyzer for instance, that you might be able to share demonstrating the issue would also be appreciated.
Likewise, if you could provide specifics regarding the MCU you are using and also the configurations of the I2S both of the MCU and the ICS-43434, I would like to cross-check those just to make sure everything lines up there. I find that often the nomenclature used for different settings in the I2S registers does not map exactly one-to-one between devices and this can result in some unexpected results.
The I2S data is formatted as 24 bit two's-complement, MSB first, with one SCK cycle delay on the data. Please see the attachment for the timing diagram for the Left Channel Only case.
Regards,
Mike
We have been rigorously testing the ICS43434 microphone in different configurations. We have ensured that the sampling rate, data size, and clock frequency are set according to the specifications provided in the datasheet.
However, despite our efforts, we have encountered some irregularities in the microphone's performance. Specifically, we have observed that the data output from the microphone appears to be highly random and does not exhibit expected reactions to changes in the surrounding environment. To provide more context, we are converting the microphone's output to two's complement and printing the MSB 24 bits of the received data for analysis.
In our testing, we have used the following configurations:
- Protocol: I2S
- Sampling rate: 8 KHz
- Data size: 32 bits
- Resolution: 32 bits
- Clock frequency: 512 KHz
- Buffer size (to store data from the mic through DMA): 256
We have verified that the configurations are correct and have attempted to troubleshoot the issue even by testing different configurations and environments. However, the randomness in the data persists.
We would greatly appreciate any insights or recommendations to help address this issue. (Attached: serial prints screenshot, Logic analyser I2S lines screenshot.)