Go Down

Topic: Using SPI on Arduino DUE to transmit audio data to WM8731 audio codec (Read 667 times) previous topic - next topic

lkahler

I've been attempting to get the Audio Codec Board based on the WM8731 to work with an Arduino DUE board, but haven't had any luck getting audio out of the WM8731. I've confirmed that the I2C interface is working by toggling the analog path to the microphone in with an audio source connected to the mic connection and headphones on the headphone output. The WM8731 is setup as the master and Arduino DUE board should be setup as a slave (I believe that the Arduino DUE is sending data via the SPI line when the DACL triggers a transfer). I've tried inverting the clock on the WM8713 and all 4 SPI modes with no luck.

Below is the main code file (supporting files attached as well):

#include <SPI.h>
#include <Wire.h>
#include "AudioOutput.h"
#include "WM8731.h"

void setup() {
  Serial.begin(9600);
  Serial.println("Initialize WM8731...");
  WM8731.begin(low, WM8731_SAMPLING_RATE(hz48000), WM8731_INTERFACE_FORMAT(DSP) | WM8731_INTERFACE_WORDLEN(bits32) | WM8731_INTERFACE_MASTER);
  WM8731.setInputVolume(31);
  WM8731.setOutputVolume(0xFF);
  WM8731.set(WM8731_ANALOG, /*WM8731_ANALOG_INSEL | WM8731_ANALOG_MICBOOST | WM8731_ANALOG_SIDETONE | WM8731_ANALOG_SIDEATT(0) |*/ WM8731_ANALOG_DACSEL);
  WM8731.setActive();
  Serial.println(" done.");
 
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  delay(1000);
  digitalWrite(4, LOW);
  audioDacInitialize();
}

void loop() {
  //Serial.println("Loop");
  delay(1000);
  Serial.println(getErrorCount());
}

benbiles

Hi, did you get this working ? trying to wire up the same codec and get audio IO on DUE.

Go Up