SAM V71 WM8904 SSC ADC sample code

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

Hello,

Would someone share with me some sample code for the WM8904 ADC side? Ideally, I would process one sample at a time.

Thanks,

Frank

This topic has a solution.
Last Edited: Thu. Oct 15, 2020 - 07:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

fullspectrum wrote:
the WM8904 ADC

You mean this: https://www.cirrus.com/products/wm8904/ ?

 

Have you looked at the resources that Cirrus provide?

 

https://www.cirrus.com/support/

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Fri. Oct 9, 2020 - 07:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> You mean this: https://www.cirrus.com/products/wm8904/ ?

Correct.

 

>Have you looked at the resources that Cirrus provide?

>https://www.cirrus.com/support/

I didn't find anything for SAM code there.

 

I just found some code here:

https://github.com/avrxml/asf/blob/master/sam/components/audio/codec/wm8904/example/wm8904_example.c

https://github.com/avrxml/asf/tree/master/sam/components/audio/codec/wm8904/example/samv71q21_samv71_xplained_ultra

 

The wm8904_example.c is the same code as what I just get through File->New->example project and search with WM8904. I will post my results.

Frank

 

P.S. I was trying to get the links from page 9 of TB3715 (What is SSC How to Configure SSC for Audio aaplications 90003175) and the asf.atmel.com the links just forwarded directly to microchip.com. the atmel.com links without asf in the front seem to work.

Relevant Resources
• Synchronous Serial Controller (SSC) of SAMV71 Devices to Output an Audio Stream Through the
On-board WM8904 CODEC
http://asf.atmel.com/docs/latest/
sam.components.audio.codec.wm8904.example.samv71_xplained_ultra/html/index.html
• Synchronous Serial Controller (SSC) of SAM3S Devices to Output an Audio Stream Through the
On-board WM8731 CODEC
http://asf.atmel.com/docs/latest/sam.components.audio.codec.wm8731.example.sam3x_ek/html/
index.html
• ASF SSC in I2S Mode Example – EVK 1100
http://asf.atmel.com/docs/latest/avr32.drivers.ssc_i2s.example.evk1100/html/index.html
• ASF SSC in I2S Mode Example – EVK 1101
http://asf.atmel.com/docs/latest/avr32.drivers.ssc_i2s.example.evk1101/html/index.html
• Connecting the Atmel ARM-based Serial Synchronous Controller (SSC) to an I2S-compatible Serial
Bus
http://www.atmel.com/Images/doc6020.pdf
• How to use the SSC in I2S mode
http://www.atmel.com/Images/doc32127.pdf
• Usage of XDMAC on SAM S/SAM E/SAM V
http://www.atmel.com/Images/Atmel-

 

 

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

fullspectrum wrote:
I didn't find anything for SAM code there.

you can't expect Cypress - or any other manufacturer - to provide specific examples for every possible 3rd-part host processor.

 

But remember that the ADC neither knows nor cares what microcontroller you're using - so you should be able to adapt their example code to the SAM ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just found that I must substitute atmel for microchip and the links work. For example,

 

https://asf.atmel.com/docs/lates...

->

https://asf.microchip.com/docs/l...

 

The  wm8904_example.c demo works. I put a function generator into the microphone and see it reproduced on the headphone output.

 

I just have to add DMA interrupt handlers so I could do processing with the buffers on the ADC and DAC sides. 

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

Good stuff!

 

Please see Tip #5 in my signature, below:

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It's getting resolved. I'm not there yet. I put a breakpoint and made a watch of the AudioBuffer buffer. The buffer is all zeros even after I run and pause the program. I don't know the cause yet.

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

Hello all,

I am going to stop this thread. I am marking the post where I put the link as the solution. I didn't resolve the audiobuffer through this sample code. I made another thread. I am posting functional code over there that does not use XDMAC while still having functional ADC and DAC using interrupt on SSC on a per sample basis.

 

https://community.atmel.com/forum/sam-v71-wm8904-ssc-one-interrupt-sample-one-interrupt-xdma-complete