SAMV71 WM8904 Configuration Issues

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

                  I am new to both Atmel Studio and SAM V71.

                  For testing audio we are using the WM8904 Example project in ASF 3.33.0 on SAM V71 xplained ultra board.

                  Regarding the code i have these doubts,

1. The configuration for Sampling Rate are the following lines

   a.  // wm8904_write_register(WM8904_CLOCK_RATES_1, WM8904_CLK_SYS_RATE(3) | WM8904_SAMPLE_RATE(5))

       wm8904_write_register(WM8904_CLOCK_RATES_1, WM8904_CLK_SYS_RATE(9) | WM8904_SAMPLE_RATE(0));

   b. //wm8904_write_register(WM8904_AUDIO_INTERFACE_1, WM8904_BCLK_DIR | WM8904_AIF_FMT_I2S);
     wm8904_write_register(WM8904_AUDIO_INTERFACE_1, WM8904_BCLK_DIR | WM8904_AIF_FMT_I2S | WM8904_AIF_WL_16BIT);

   c.   wm8904_write_register(WM8904_AUDIO_INTERFACE_3, WM8904_LRCLK_DIR | WM8904_LRCLK_RATE(0xC0));

    If anything more please help me with the 8KHz sampling rate. The playback output from speaker seems to be fine, but how do i verify that the output is actually 8KHz.

 

Thankyou,

Uday

This topic has a solution.
Last Edited: Thu. Feb 9, 2017 - 02:25 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey UdayMani1, you can check this by getting an oscilloscope and check pin 30 (LRCLK) on the WM8904 or PB00 (this a pin that also connects to TF/LRCLK stuff). I would suggest checking out the WM8904 and SAMV71 xplained datasheets as well to confirm this because I've never used the chip or board before; I found the following information by checking those datasheets as well. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks rfoo for the reply.

We tried to do that by obtaining the samples(main project goal) in XDMAC Handler(interrupt comes for every block of samples received) and write those to a file in sdcard using f_write of fatfs. But it is not helping.

The signal we recorded has so much noise along with little distracted audio which is given as input.

And always the plotted wave has some DC component(wave is shifted to above the horizontal axis)

I suspect that we missed something about the 8KHz configuration.

Last Edited: Thu. Feb 9, 2017 - 05:55 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey Uday, like I said you should use an oscilloscope; it's probably the easiest way to check. I've always used a digital scope to check my codec's sample rate and no other way. Obtaining the samples in the XDMAC Handler will not give you the sample rate, you're just obtaining samples from the codec. 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi rfoo,

Thank you very much for replying.

After 1 week of digging through the datasheets of both Atmel SAMV71 and WM8904 Codecs, we found the answer.

The configuration to the 8Khz is correct.

The problem is the SSC acting as a slave and WM8904 as master. There is this errata about this in the Datasheet itself.

There is this unexpected delay of 2 or 3 system clock cycles is added to TD output which is causing our data to be distorted.

This we avoided by increasing the SSC receive and transmit data lengths to 16 instead of 15(which is the current configuration) and also setting the FrameSyncEdge Detection to positive for both Rx and Tx .

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi UdayMani1, excuse me but I'm traying for use the wm8904 but I don't know how to get start, I don't know if may you give me a example of your program. Regards and thanks in advance. my e-mail is "mzm92@hotmail.com"