USB Audio 2.0

Discussion around product based on ARM Cortex M3 core.
This forum will be discontinued soon.

Moderators: nferre, ncollot

euphoricnoise
Posts: 13
Joined: Wed Jun 11, 2014 8:21 pm

USB Audio 2.0

Thu Jun 26, 2014 9:36 pm

Hi everyone!

I was wondering if there are audio usb libraries or references for the SAM3U-EK laying somewhere around here. I've tried looking at the atmel website but I haven't had any luck yet. The only documentation about audio usb 2.0 I've had so far is from the usb.org website.

In terms of code, I've written up the descriptors and class requests for audio usb 2.0 so far. I've started writing setup and other such functions but it would be awesome if any of you knew some documentation or could help me out here! :D

Thanks
Ryan
Andy Peters
Posts: 46
Joined: Mon Jul 08, 2013 11:09 pm

Re: USB Audio 2.0

Mon Jun 30, 2014 7:56 pm

euphoricnoise wrote:I was wondering if there are audio usb libraries or references for the SAM3U-EK laying somewhere around here. I've tried looking at the atmel website but I haven't had any luck yet. The only documentation about audio usb 2.0 I've had so far is from the usb.org website.

In terms of code, I've written up the descriptors and class requests for audio usb 2.0 so far. I've started writing setup and other such functions but it would be awesome if any of you knew some documentation or could help me out here! :D
I've just started working on this. Gonna take a while, though.
euphoricnoise
Posts: 13
Joined: Wed Jun 11, 2014 8:21 pm

Re: USB Audio 2.0

Mon Jun 30, 2014 8:29 pm

Andy Peters wrote:
I've just started working on this. Gonna take a while, though.
Ya it's a very long process :(
Let me know if you get it working! I'll let you know if I make more progress!
euphoricnoise
Posts: 13
Joined: Wed Jun 11, 2014 8:21 pm

Re: USB Audio 2.0

Thu Jul 10, 2014 9:16 pm

Hi so I've made some progress and now my computer detects my evaluation board (SAM3U-EK) as a composite USB device (audio and HID!). However, there is an error with the Audio Device part. It says the device cannot start.

Can anyone help/give me a clue why it is not starting up properly? Maybe it's the way I'm writing the descriptors? Any usb audio experts out there?

Sorry for the sort-of bump
Andy Peters
Posts: 46
Joined: Mon Jul 08, 2013 11:09 pm

Re: USB Audio 2.0

Mon Jul 14, 2014 7:22 am

euphoricnoise wrote:Hi so I've made some progress and now my computer detects my evaluation board (SAM3U-EK) as a composite USB device (audio and HID!). However, there is an error with the Audio Device part. It says the device cannot start.

Can anyone help/give me a clue why it is not starting up properly? Maybe it's the way I'm writing the descriptors? Any usb audio experts out there?
Does it enumerate as an Audio Class 2.0 or 1.0 device? The descriptors for the former are more involved than for the latter.

Do you have a bus analyzer which will let you see what is happening?
euphoricnoise
Posts: 13
Joined: Wed Jun 11, 2014 8:21 pm

Re: USB Audio 2.0

Mon Jul 14, 2014 3:28 pm

Andy Peters wrote:Does it enumerate as an Audio Class 2.0 or 1.0 device? The descriptors for the former are more involved than for the latter.

Do you have a bus analyzer which will let you see what is happening?
Hi Andy,

I'm enumerating it as an Audio Class 2.0.

For my Audio Control Descriptor, I am defining:
- USB Interface Descriptor
- Class-Specific Audio Control Descriptor
- For both Input and Output Directions:
- Input Terminal Descriptor
- Output Terminal Descriptor
- Feature Unit Descriptor
- Clock Source Descriptor

I'm afraid I do not have a bus analyzer. As this is my first time working with USB Protocol, I am not sure what I need to troubleshoot properly.

EDIT: I've been using a free usb bus monitor software and I've noticed that my terminal, feature unit descriptors are not being detected so I'll look more into it and let you know later

EDIT2: So I've switched over to USB Audio 1.0 (since it was easier to understand and test it) and I've got the following (below). Only problem is that it's still doesn't function properly. Any ideas? Am I still not enumerating correctly?

Code: Select all

Configuration Descriptor
 Number of interfaces: 4
 Configuration value: 0x1
 Attributes: Remote wakeup, Bus powered
 Max power: 100 mA

Interface Descriptor: 0, Alternate setting: 0
 Number of endpoints: 1
 Interface class: 0x3 - Human Interface Device
 Interface subclass: 0x1 - Boot Interface Subclass
 Interface protocol: 0x2 - Mouse
 Endpoint address 0x1, Input, Interrupt, max packet size: 8 bytes, update interval: 512 microframes

Interface Descriptor: 1, Alternate setting: 0
 Number of endpoints: 0
 Interface class: 0x1 - Audio
 Interface subclass: 0x1 - Control Device
 Interface protocol: 0x0 - Unknown

Audio Control (AC) Descriptor: Header Descriptor
Audio Device Class Specification Release Number: 256
Total Length: 70
Number of Interfaces: 2
Interface0: 3
Interface1: 2

Audio Control (AC) Descriptor: Input Terminal Descriptor
Unit ID: 4
Terminal Type: 257
Associated Output Terminal: 0
Number Of Output Channels 1
Channel Configuration: 1
Name (String Descriptor ID): 0
Description (String Descriptor ID): 0

Audio Control (AC) Descriptor: Output Terminal Descriptor
Unit ID: 6
Terminal Type: 257
Associated Output Terminal: 0
Source ID: 5
Description (String Descriptor ID): 0

Audio Control (AC) Descriptor: Feature Unit Descriptor
Unit ID: 5
Source ID: 4
Control Size: 2
Description (String Descriptor ID): 0

Audio Control (AC) Descriptor: Input Terminal Descriptor
Unit ID: 1
Terminal Type: 257
Associated Output Terminal: 0
Number Of Output Channels 1
Channel Configuration: 4
Name (String Descriptor ID): 0
Description (String Descriptor ID): 0

Audio Control (AC) Descriptor: Feature Unit Descriptor
Unit ID: 2
Source ID: 1
Control Size: 2
Description (String Descriptor ID): 0

Audio Control (AC) Descriptor: Output Terminal Descriptor
Unit ID: 3
Terminal Type: 257
Associated Output Terminal: 0
Source ID: 2
Description (String Descriptor ID): 0


Interface Descriptor: 2, Alternate setting: 0
 Number of endpoints: 0
 Interface class: 0x1 - Audio
 Interface subclass: 0x2 - Streaming
 Interface protocol: 0x0 - Unknown

Interface Descriptor: 2, Alternate setting: 1
 Number of endpoints: 1
 Interface class: 0x1 - Audio
 Interface subclass: 0x2 - Streaming
 Interface protocol: 0x0 - Unknown

Audio Streaming (AS) Descriptor: Class-Specific Descriptor
Terminal Link: 3
Delay 1
Format Tag: 1

Audio Streaming (AS) Descriptor: Format Type Descriptor
Format Type: 1
Number of Channels: 1
Subframe Size: 2
Bit Resolution: 16

 Endpoint address 0x5, Input, Isochronous, max packet size: 512 bytes

Audio Streaming (AS) Isochronus Audio Data Endpoint Descriptor
Attributes: 00000001(bitmap)
Delay Units: 0
Lock Delay: 0


Interface Descriptor: 3, Alternate setting: 0
 Number of endpoints: 0
 Interface class: 0x1 - Audio
 Interface subclass: 0x2 - Streaming
 Interface protocol: 0x0 - Unknown

Interface Descriptor: 3, Alternate setting: 1
 Number of endpoints: 1
 Interface class: 0x1 - Audio
 Interface subclass: 0x2 - Streaming
 Interface protocol: 0x0 - Unknown

Audio Streaming (AS) Descriptor: Class-Specific Descriptor
Terminal Link: 4
Delay 1
Format Tag: 1

Audio Streaming (AS) Descriptor: Format Type Descriptor
Format Type: 1
Number of Channels: 1
Subframe Size: 2
Bit Resolution: 16

 Endpoint address 0x6, Output, Isochronous, max packet size: 512 bytes

Audio Streaming (AS) Isochronus Audio Data Endpoint Descriptor
Attributes: 00000000(bitmap)
Delay Units: 0
Lock Delay: 0
Thanks
Andy Peters
Posts: 46
Joined: Mon Jul 08, 2013 11:09 pm

Re: USB Audio 2.0

Tue Jul 15, 2014 12:24 am

euphoricnoise wrote:EDIT2: So I've switched over to USB Audio 1.0 (since it was easier to understand and test it) and I've got the following (below). Only problem is that it's still doesn't function properly. Any ideas? Am I still not enumerating correctly?

Code: Select all

Configuration Descriptor
 Number of interfaces: 4
 Configuration value: 0x1
 Attributes: Remote wakeup, Bus powered
 Max power: 100 mA

Interface Descriptor: 0, Alternate setting: 0
 Number of endpoints: 1
 Interface class: 0x3 - Human Interface Device
 Interface subclass: 0x1 - Boot Interface Subclass
 Interface protocol: 0x2 - Mouse
 Endpoint address 0x1, Input, Interrupt, max packet size: 8 bytes, update interval: 512 microframes[/quote]

Why a mouse/boot interface? That's a rather special interface; instead, do some kind of user-defined report format.

I'll dig up descriptors later. I think there are things missing from yours, but I don't have any references here to verify against.
euphoricnoise
Posts: 13
Joined: Wed Jun 11, 2014 8:21 pm

Re: USB Audio 2.0

Tue Jul 15, 2014 3:33 pm

Andy Peters wrote: Why a mouse/boot interface? That's a rather special interface; instead, do some kind of user-defined report format.

I'll dig up descriptors later. I think there are things missing from yours, but I don't have any references here to verify against.
I wanted to test some things later using a composite HID/audio device. But if you could verify the descriptors with me because so far I know I need:
- AudioControl Descriptor (containing Terminal, Feature Unit descriptors)
- 2 AudioStreaming Descriptors (One input and one output stream)

UPDATE: Looks like I finally got it working. It was actually a problem with the terminal type I was setting it to. In my own confusion, I had set the terminal types in the opposite direction and it wasn't able to run from there. I am working on connecting the usb stream data to an I2S bus now. Will let you guys know where I end up.
thorsten.eisbein2
Posts: 1
Joined: Wed Oct 05, 2016 4:42 pm

Re: USB Audio 2.0

Wed Oct 05, 2016 4:48 pm

Hi,

did you finished your project? I have a SAM3U-EK since 3 years, but never used it (no time, other projects). Now I want to start USB audio (Class 1 and 2) and just wondering if I may get some tips how to start.
AFS does not supply a USB audio class at all? Should I use it anyway and writing my own Class? Or do you have any code you might share?

Thanks!
euphoricnoise
Posts: 13
Joined: Wed Jun 11, 2014 8:21 pm

Re: USB Audio 2.0

Tue Nov 15, 2016 8:42 pm

thorsten.eisbein2 wrote:Hi,

did you finished your project? I have a SAM3U-EK since 3 years, but never used it (no time, other projects). Now I want to start USB audio (Class 1 and 2) and just wondering if I may get some tips how to start.
AFS does not supply a USB audio class at all? Should I use it anyway and writing my own Class? Or do you have any code you might share?

Thanks!

Hey thorsten, I never did manage to make it work. The input was always distorted/a lot of jitter. Output was always fine as far as I could tell. Atmel gave me a couple of unfinished files that I ended up fixing (it was VERY broken and they even told me it would only work with Class 1) and it still didn't work. They even suggested me to overclock the chip which isn't something I wanted to do in the first place... Honestly it seems like it's just not worth to build USB Audio for the SAM3U. Obviously the SAM3U is a nice cost-effective chip but not for USB Audio. I'm hoping someone here will prove me wrong but its been almost 3 years since I started asking on the forum and no one really had a real solution from what I could tell.

With that in mind, if you wish to continue with the SAM3U for USB audio... good luck and may God play in your favor lol
mehdi
Posts: 3
Joined: Mon Dec 12, 2016 9:24 am

Re: USB Audio 2.0

Mon Dec 19, 2016 11:28 am

Hello euphoricnoise, I am trying to code a USB audio device class 1 or 2 on a SAM G55, there is not much information about it on the web and I am kind of lost in this so I was wondering if you could share some of your code ?

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: No registered users and 1 guest