Page 1 of 1

WM8731 Slave on Arduino

PostPosted: Thu May 14, 2015 8:21 am
by r4d10n
Hello folks,

I'm experimenting with WM8731 and Arduino and would like to use MCLK connected to the Arduino for generating the master clock (like typically done with FPGA and ARM controllers), even if running at lower sampling rates.

Could any one suggest the modifications to be made on the Open Music Labs WM8731 Arduino code to make it support the slave mode ? I'm willing to experiment with code, if I could know the feasibility and direction of doing the same.

Regards

r4d10n

Re: WM8731 Slave on Arduino

PostPosted: Thu May 14, 2015 12:31 pm
by guest
there are 2 slave/master relationships with the codec. 1. who generates MCLK, and 2. who generates BCLK. the codecshield is hard-wired for the arduino to generate BCLK. this could be changed, but would require cutting traces on the PCB and running some small jumper wires. MCLK is more flexible, as all you need to do is remove the crystal, and solder a new wire to your MCLK generating pin on the arduino. it might be good to use a 100ohm resistor in series with this wire, to keep ringing on the line down.

you will want to drive it with one of the PWM pins on the arduino. i would reccomend pin3 for this (OC2B), as timer1 is being used for timing BCLK, and timer0 is being used by the arduino itself (this can be over-ridden if neccessary). in theory, you dont need timer1 if youre generating MCLK yourself, but it will be less code changing to keep things the way they are. the fastest frequency it will be able to produce is 8MHz, so the sample rate will scale accordingly.