adafruit / Adafruit_ZeroI2S

I2S audio playback library for the Arduino Zero / Adafruit Feather M0 (SAMD21 processor).
MIT License
33 stars 16 forks source link

How to read Mono Channel Data? #12

Open Bashima opened 2 years ago

Bashima commented 2 years ago

I am using an Adafruit I2S Mic with M0 Feather Board. Which parameters/flags do I need to change to read MONO channel data? Currently it is reading stereo data.

ikivela commented 2 years ago

I'm also having difficulties to read only left channel. I have adafruit i2s mems microphone breakout and metro M4.

cujomalainey commented 2 years ago

I think I figured out the issue, something about mono messes with the interrupts. The regular I2S lib does not check the interrupts, but this one does on the blocking read. This results in some weird behaviour that I have not been able to figure out. If you remove the checks on I2S->INTFLAG.bit.RXRDY0 from the while loops the blocking reads work perfectly.

cujomalainey commented 2 years ago

~The other thing I had to fix as well was I2S_SERCTRL_SLOTADJ_LEFT was used in the regular lib where as this one is RIGHT, also for mems you need I2S->CLKCTRL[_i2sclock].bit.BITDELAY = I2S_CLKCTRL_BITDELAY_I2S_Val;~

Scratch that, just the interrupt needs to be adjusted

tokenwill commented 10 months ago

I was originally having an issue getting good I2S data out to the serial port. The fix @cujomalainey recommended has helped!

Was getting serial data like 1 -10 -45 30 0 0 0 0 0 0 0 54. Couldn't figure out why I couldn't code in skipping the zeros. But commenting out the INTFLAG for RXRDY0 like suggested has worked like a charm.