I2S problem

I am using the ArduinoDueHifi library (https://github.com/delsauce/ArduinoDueHiFi). It configures the Arduino DUE's SSC controller to operate in I2S mode for interfacing with external CODECs.

The problem is, I do not get output on the TD line from the Due.

I am using the following code to produce a 12MHz clock signal to run the Codec:

REG_PIOA_WPMR = 0x50494F00;  // enable writes
REG_PIOA_PDR |= 0x02;        // enable peripheral control
REG_PIOA_PER &= ~0x02;        // Prevents disabling peripheral control of the pin
REG_PIOA_ABSR |= 0x02;       // B preipherial select
REG_PIOA_WPMR = 0x50494F01;  // disable writes
REG_PMC_WPMR = 0x504D4300;   // enable writes
REG_PMC_SCER |= 0x100; //page 558!!!
PMC->PMC_PCK[0] = 0b00000000000000000000000000000001;       // master clock = 12Mhz (crystal freq)
//REG_PMC_WPMR = 0x504D4301;   // disable writes (unnecessary)

Has anyone ever used the SSC controller for I2S? Does anyone know if generating this timer signal via the PMC could prevent the SSC controller from working correctly?

So I just discovered that if I remove the line

REG_PIOA_WPMR = 0x50494F01; // disable writes

then I get an outout from TD. But only on one side of both channels an it's a sine wave of about 50Hz! Seems like this line of code prevents the Pin from working? Could that be? But the next question is why a 50Hz sine of 3V? I am running on 48kHz sample rate now. Any ideas?

It's working now. :D In case anyone is interested, i made a HIFI DSP shield for the arduino due using a Wolfson WM8731 Codec. I'll post some documentation on this project as soon as I get to it.

im really interested :)

Hi , I'm interested too !!! did you get around to posting any of the code ?

hirschmensch: It's working now. :D In case anyone is interested, i made a HIFI DSP shield for the arduino due using a Wolfson WM8731 Codec. I'll post some documentation on this project as soon as I get to it.

Hey I am trying to run the HiFi library to communicate with the WM8731 codec with arduino due. But I do not get any data from the codec shield.Could you please post your source code and some documentation?

interested!! previously i did I2S with programmed IO, but this wasted vast amounts of MPU time…

Sorry for the late response guys, I will post a github link to a dedicated WM8731 library soon!

If anyone's interested in I2S in and good quality audio general on microcontrollers, I've been doing a similar project on Teensy 3.1 for the last couple years. It's sending and receiving I2S stereo quite nicely (and also mono on the built in ADC and DAC), and a good number of audio processing features are implemented, and even a web-based GUI for defining the audio paths and documentation of the many features. Here's the source code. Some of the code might port to Due, but quite a lot depends on the specific DMA features on Freescale's chip.