I have interfaced a I2S digital microphone to PIC32MZ controller. I am able to read the digital output from the microphone over I2S-DMA transfer.
Following are the details of my set-up:-
- Controller:- PIC32MZ1024EFE064
- Audio Sensor:- SPH0645LM4H-B
- MPLAB Harmony Configurator (MHC) v126.96.36.199
When I play some tone near the microphone, I get somewhat these values:-
I tried to cover the microphone with glue and tape (so that it does not catch any audio signals), and got the following values:-
In the answer to the post Digital Microphone : I2S data output, it is mentioned that the 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.
In my set-up, the MSB is always 1 (or 0xF), no matter what input I give to my microphone. I am planning to use my data to calculate the mean, average and peak-to-peak values. So, the sign-bit is important to me.
Now, I have used MPLAB Harmony to configure my I2S.
My questions are,
- If the one clock offset of the I2S clock is causing the MSB of my data to always be 1, which settings/code should I modify in MPLAB to resolve this issue?
- Apart from the I2S clock issue, what else can be the issues that I must resolve in order to read correct data from my microphone?
Thanks in advance