Code hangs when I try to access I2S registers

Status
Not open for further replies.

mdion

Member
I am developing a board that interfaces the Teensy 3.2 with the WM8782A dual-channel ADC via I2S interface. I was able to find plenty of example code online, but when I try to implement it myself, I am not even able to read or write to any of the I2S registers! Here is some simplified code I tried to run:

************************
void setup() {
delay(5000); //gives me time to open Serial Monitor
Serial.begin(9600);
Serial.println("Begin");
I2S0_TCSR = 0;
Serial.println("1");
}

void loop() {}
*****************************

The Arduino serial monitor will print "Begin" but not "1."

If I can't perform simple read/write operations to SFR's, I'm stuck!
 
You have to enable the I2S-Device first:
Code:
    SIM_SCGC6 |= SIM_SCGC6_I2S;

Maybe take a look at AudioOutputI2S::config_i2s in output_i2s.cpp
 
Wow, that's great, thanks!

I originally had this line of code, but didn't include it until after I configured all of the I2S registers. I had no idea you had to do that first!
 
Status
Not open for further replies.
Back
Top