USB Audio - App note AVR32716

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

Hi,

anybody tried to follow this app note? What's your experience?

I'm looking for the best device to implement asynchronous USB audio at the highest possible data rates. There are various offerings out there and I wonder how feasible the AT32UC3 is. I have used plenty 8-bit AVR and it would be fun to make the minimal transition.

I'll need to support sample rates of 44.1, 48, 88.2, 96, and hopefully 176.4 and 192 ksps with 24 bit stereo samples. The result needs to operate on asynchronous USB. I have two switchable system clocks at the DAC operating on 44.1x256 and 48x256.

The app note has fewer sample rates and synchronization options available.

Also, where should I downlod the files?

Thanks,
Borge

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

Look for UC3 Software framework on atmel.com, all source code is there.
I suggest the use of the external PLL which is the best synchronisation (accuracy vs jitter) between the USB and DAC stream.
-sma

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

Hi Sma,

I got the framework but I didn't see any project files for the app note. I'm completely new to avr32studio so I haven't yet been able to pick the right framework components and integrate them in a project. Is there a tutorial on how I should do this?

I have done plenty of 8-bit avrgcc in Programmer's Notepad and avrstudio 4 but the new GUI and its concept of projects is new to me. A dummy's step-by-step guide would do me some good. I assume it's not very difficult once you get the initial hang of it.

In my system (at least for the time being) the DSPing is done in an FPGA which also receives the DAC's reference clocks. With its PLLs I can generate a wealth of clocks. For the future I might move the DSP functions to AVR32. So at least for now configuring a clock source shouldn't be a problem.

Borge

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

Look in services/usb/(_asf_v1)/class/audio

You can access the code directly in AVR32 Studio (ASF1.7).
The code for ASF2.0 is only available in zip file for now:
http://asf.atmel.no/source/asf-2...

-sma

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

Hi Sma,

Thanks for the link!

I'm slowly getting into avrstudio32. Now the usb audio project from ASF1.7 is building successfully for EVK1105. I want to code for the EVK1104 but there were fewer USB audio examples for it, at least in 1.7.

How do I make avrstudio32 aware of the files in ASF2.0 once I unzip them?

Also, I can't use the Search menu and find #define BOARD for the examples. Do you know where it is defined?

Thanks,
Borge

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

At least I was able to answer the second one:

There is no
#define BOARD

but a setting at:

->right click->Properties->C/C++ Build->Settings->Tool Settings->Symbols

Borge

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

Hi Borg,

U might like to see the sdr-widget project. Google for it.

We have 48/96/192 kHz 24 bit full duplex capture and playback async ISO with rate feedback working using UAC2.

Alex

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

Dude, that rocks!

I was in touch with Atmel support who said 192ksps at stereo 24 bits wouldn't work. I'll read your code and see how you did int. See Q&A below.

For my own project I'll need to add HID and UART while removing some of the metering.

Cheers,
Borge

Quote:

Q: My products should use 44.1, 48, 88.2 and 96ksps, preferably also 176.4 and 192ksps. Resolution should be 24-bit stereo

A: The AT32UC3A, AT32UC3B devices can support upto 48khz sampling rate as mentioned in application note. For AT32UC3A3 device, as it supports high speed USB, it can support 88.2 and 96khz sampling rate with 24 bit. But for higher sampling rates such as 176.4 and 192khz with 24 bit stereo the USB end point can not support the number of bytes required(1152 for 192khz,1059 for 176.4) for every millisecond. Because the USB end point can support at the maximum 1024 bytes for AT32UC3A3. But for the I2S, it should be possible to output 192khz sampling rate.

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

Hi Borge,

The Atmel guys are still thinking of UAC1, with the limitation of Windows driver which communicates every 1ms.

With UAC2, the USB transfer can take place every 125us, so 192khz stereo full duplex is no problems.

There are also other issues that the Atmel guys will tell you it is not possible to do. For example, they think that the SSC in the UC3A3 can only have a mono channel in capture if a stereo playback is taking place. In fact, it can be done if you set up the i2S signals properly with our tricks.

Another issue is prevention of channel inversion. It is tricky with the UC3A3 as the i2S transfers use DMA, and it runs asynchronously with the USB transfers. Some have reported this issue to Atmel as possible silicon "bugs". However, it can be worked around with our tricks.

btw, our firmware makes the widget a USB composite device, already with HID, CDC, libusb, and audio interfaces all working concurrently.

Alex

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

I'm downloading your code now. Eager to look at it!

My application is a replacement for PCM2705 with higher capabilities. I do DACs and CD players. Up until now they are built around an atmega16 and a Xilinx FPGA.

Just how impossible is it to make it work at 88.2/96 24-bit stereo playback-only async on UAC1 on a Windows platform?

Which other hardware do I need beside your Widget? AVRDRAGON? A display? I'm experienced with AVR and C but this will be my first AVR32 project.

Borge

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

Hi Borge,

There are problems with Windows USB Audio drivers:

(1) Limited to UAC1, no UAC2 support;
(2) Async OUT with rate feedback reported to work only in Vista (but not at 192khz). Does not work in WinXP at all. Don't know whether works in Win7. Win7 has worse ISOCHRONOUS performance than Vista so may have big problems at high sampling rates.

So big manufacturers bypass Windows UAC completely and write custom drivers, using USB bulk transfer. In fact, I am writing a version of the widget firmware using bulk transfer as well.

UAC2 is the way forward. However, it is only supported in Linux (kernel 2.6.35 or later) and Mac OSX (snow leopard) only. For Windows, there are commercial UAC2 drivers from several companies. However, those drivers cost $$$, and works only for simple audio devices, not for composite devices.

With UAC1, there is no known solution for the UC3A3 to get to 96khz or beyond. I figured out that it might be possible to do it with AP7000 :-) Basically you need max EP size of > 512 bytes, and/or multiple transactions per uFrame. Both options not supported by UC3A3.

As for the sdr-widget, you don't need any other hardware. The 20x4 LCD display is optional (but very useful for debugging). You can use the DFU USB bootloader to load the firmware. (However, the sdr-widget can be programmed with the JTAG-MKII directly as well.)

Alex

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

I was hoping to reach 44.1, 48, 88.2 and 96 in stereo 24-bit on driverless Windows. And add 176.4 and 192 in UAC2. I'll be able to test on XP and Win7. A Linux box should also be within easy reach.

Borge

P.S. In Cygwin got:
$ svn checkout http://sdr-widget.googlecode.com...
svn: URL 'http://sdr-widget.googlecode.com...' doesn't exist

Same thing with ' ' between / and sdr-widget-read-only as on the web site.

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

We have removed the svn for the time being. You go to download page and download the AVR32 studio project compressed with tar.gz.

Extract the folder to a convenient location, eg Desktop.

Then in AVR32 Studio, use File > Import to import it.

After importing it, change the default build option to "Release" before building the project.

Suggest you try the demo_UAC1_v087 first. This works in Windows XP.

Alex

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

alexlee188 wrote:

(2) Async OUT with rate feedback reported to work only in Vista (but not at 192khz). Does not work in WinXP at all. Don't know whether works in Win7. Win7 has worse ISOCHRONOUS performance than Vista so may have big problems at high sampling rates.

Hello!
Async OUT with rate feedback UAC 1 works fine in WinXP and Win7 (but for Win7 may be needed largest buffer size ). I have implemented this mode on at32uc3a3256, and my russians DIY collegues on Cortex-M3 controllers.
On UC3A3 to get up to 24x48khz (512 EP fifo), on Cortex up to 24x96khz (1023 EP fifo). UAC 2 also work on WinXP/Win7 (up to 32x192kHz), but but there is a need commercial drivers (Thesycon or Centrance).

Nikolay

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

Hi Nikolay,

Great! Thanks for the info on Windows UAC compatibility. We are working on a USB-DAC with PCM1794A and alternatively ES9012

What is the rate feedback format in Windows? In Linux it is 12.13, and in OSX 16.16 The latest Ljnux kernel 2.6.36 or later has auto.rate feedback sensing and will work with whatever format.

Alex

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

alexlee188 wrote:
Hi Nikolay,

Great! Thanks for the info on Windows UAC compatibility. We are working on a USB-DAC with PCM1794A and alternatively ES9012

What is the rate feedback format in Windows? In Linux it is 12.13, and in OSX 16.16 The latest Ljnux kernel 2.6.36 or later has auto.rate feedback sensing and will work with whatever format.

Alex

My goal is USB I2S source for external custom audio DAC.
(with PCM63 or AD1865 or AD1853 ) :D .
Rate feedback format for UAC 1 is 10.14,
I use this code to calculate:

playback_FB_rate = (FB_rate_int_in_kHz << 14) | (FB_rate_frac_in_kHz << 4);

(on linux this also work, OSX not tested).
I change only the integer part in feedback info to prevent buffer under/overflow.

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

Guys,

this is good news! I just ordered my boards and look forward to start playing with the code. Alex has published.

Borge