Hello, I have been working on trying to integrate the PMOD I2S2 into my MKR Zero, using the I2S interface. I was hoping you might help me to troubleshoot what I have done wrong. The overall goal is to be able to read in an audio signal to my Arduino and trigger certain events based the audio input. I am very new to working with Arduino and have gotten some basic projects done with some LED lights. I thought that the PMOD I2S2 module would be able to work with my Arduino since it has ports for the I2S protocol.
Here is how I wired the PMOD I2S2 into the Arduino MKR Zero:
ADIN MCLK -> Purple -> D12 I2S_MCK[0]
ADIN LRCK -> Grey -> D3 I2S_FS[0]
ADIN SCLK -> Black -> D2 I2S_SCK[0]
ADIN SDOUT -> Brown -> A6 I2S_SD0
GND -> Blue -> GND
VCC -> Red -> VCC
Attached is the MKR Zero Pin Out and photos of how I currently have the PMOD I2S2 wired into the Arduino. I have the PMOD Slave/Master jumper set to slave.
After having gone through the wiring I pulled in the Arduino built in I2S library. From there I implemented the most basic reading example they have on the I2S repo. I am not getting any data input. I have the PMOD Line In connected by an AUX cable connected to my laptop. I am then playing some audio on the laptop. Once the Arduino boots up I do not end up getting any data from the `I2S.read()` call. I am not sure what I might be doing wrong or if it is even possible to interface the PMOD I2S2 and an Arduino. Maybe I have something misconfigured in my code or I have connected the wrong PMOD pins to the I2S inputs on the Arduino? Any help would be greatly appreciated.
#include <PatternPlayback.h>
#include <I2S.h>
void setup() {
delay(3000); // power-up safety delay
// Open serial communications and wait for port to open:
// A baud rate of 115200 is used instead of 9600 for a faster data rate
// on non-native USB ports
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// start I2S at 24 kHz with 32-bits per sample
if (!I2S.begin(I2S_PHILIPS_MODE, 8000, 32)) {
Serial.println("I2S - Failed to initialize");
while (1); // do nothing
}
Serial.println("I2S - Successfully initialized");
}
void loop() {
int sample = I2S.read();
if (sample) {
Serial.println("I2S Transmission Received");
Serial.println(sample);
}
}