Skip to contentSkip to conversation

USB asynchronous mode feedback format

DISCUSSION Julian Scheel 2 participants 5 messages Oct 13, 2010 – Oct 14, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

I am currently working on an USB-Audio device based on a AT91SAM7 processor. Actually I am currently trying to get the asynchronous mode working, to be able to use the AT91SAM7 as I2S transmitter in slave mode, utilizing and external clock.
So I added the endpoint descriptors for the Feedback pipe. I attached the lsusb output.
Alsa detects the card properly and reports it to be async in the /proc/asound interface. Now for a first tested I am trying to report back a constant rate through the feedback pipe. The stream is 48kHz with 16Bit. Reading the USB Audio 1.0 spec I assume in theory for a 48kHz stream I would report a rate of 48 samples per frame to the host, compensated by the measured drift. As the data should be 10.14 encoded I currently send { 0x0c, 0x00, 0x00 } on the feedback pipe whenever it is queried, which happens whenever I try to play some stream on this device.
But unfortunately the host won't send any data to the device. I am wondering what might be wrong and where to check that alsa received the feedback data properly?

I would be really thankful for any help!

Regards,
Julian

Bus 001 Device 100: ID 03eb:6128 Atmel Corp.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00

  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x03eb Atmel Corp.
  idProduct          0x6128 
  bcdDevice            1.00
  iManufacturer           1 Atmel
  iProduct                2 Desktop speaker
  iSerial                 3 0123
  bNumConfigurations      1

Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 119
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 100mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 40
bInCollection 1
baInterfaceNr( 0) 1
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 0
wTerminalType 0x0101 USB Streaming
bAssocTerminal 1
bNrChannels 2
wChannelConfig 0x0003
Left Front (L)
Right Front (R)
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0301 Speaker
bAssocTerminal 0
bSourceID 2
iTerminal 0
AudioControl Interface Descriptor:
bLength 10
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 2
bSourceID 0
bControlSize 1
bmaControls( 0) 0x01
Mute Control
bmaControls( 1) 0x00
bmaControls( 2) 0x00
iFeature 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 2
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 0
bDelay 0 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 2
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x04 EP 4 OUT
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
bRefresh 0
bSynchAddress 132
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x00
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x84 EP 4 IN
bmAttributes 17
Transfer Type Isochronous
Synch Type None
Usage Type Feedback
wMaxPacketSize 0x0003 1x 3 bytes
bInterval 1
bRefresh 6
bSynchAddress 0
Device Status: 0x0000
(Bus Powered)

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw
Quoted 3 lines · Julian Scheel <julian <at> jusst.de> writes:

Hi Julian,

The current alsa rate feedback rate feedback format is 12.13 in 4 bytes. Clemens has a patch to make the rate feedback format automatic such that it will work with 10.14 16.16 or any other formats. We are still testing the patch put . Currently with 12.13 format rate feedback works well.

Mac OSX can work with 10.14 and 16.16.

However, I think your problem lies elsewhere .

For example, AT91SAM7 has a limitation of EP siE of 64 bytes for EP 3 used for ISO transfers. There may also be a limitation in that the Same EP number cannot be used for both IN and OUT.

7
Alex

Quoted 1 line
#2 lore raw

Hi Alex,

Quoted 6 lines · Alex

The current alsa rate feedback rate feedback format is 12.13 in 4 bytes. Clemens has a patch to make the rate feedback format automatic such that it will work with 10.14 16.16 or any other formats. We are still testing the patch put . Currently with 12.13 format rate feedback works well.

How does it come that alsa uses 12.13? I don't see that mentioned in the specs? Is it right or left aligned in the 4 bytes?

Quoted 4 lines

For example, AT91SAM7 has a limitation of EP siE of 64 bytes for EP 3 used for ISO transfers. There may also be a limitation in that the Same EP number cannot be used for both IN and OUT.

Hm, I'm not sure about this. You think I should move the feedback pipe into it's own EP? I will recheck the At91SAM7 specs later, to see if I can find a note on such a limitation.

Thanks,
Julian

#3 lore raw

19.13 with the most sig 7 bits not used.

Alex

Sent from my iPhone

Quoted 26 lines · Julian Scheel

Hi Alex,

Quoted 6 lines · Alex

The current alsa rate feedback rate feedback format is 12.13 in 4 bytes. Clemens has a patch to make the rate feedback format automatic such that it will work with 10.14 16.16 or any other formats. We are still testing the patch put . Currently with 12.13 format rate feedback works well.

How does it come that alsa uses 12.13? I don't see that mentioned in the specs? Is it right or left aligned in the 4 bytes?

Quoted 4 lines

For example, AT91SAM7 has a limitation of EP siE of 64 bytes for EP 3 used for ISO transfers. There may also be a limitation in that the Same EP number cannot be used for both IN and OUT.

Hm, I'm not sure about this. You think I should move the feedback pipe into it's own EP? I will recheck the At91SAM7 specs later, to see if I can find a note on such a limitation.

Thanks,
Julian

#4 lore raw
In reply to Julian Scheel

--- Julian Scheel <[email protected]> wrote:
There may also be

Quoted 7 lines
Quoted 2 lines

a limitation in that the Same EP number cannot be used for both IN and OUT.

Hm, I'm not sure about this. You think I should move the feedback pipe into it's own EP?
I will recheck the At91SAM7 specs later, to see if I can find a note on such a limitation.

Hi Julian,

You might like to refer to this thread:

http://www.avrfreaks.net/index.php?name=PNphpBB2&file=printview&t=88432&start=20

As I have found out, it is not necessary to have the same EP number for IN and OUT for rate feedback to work with a Linux or OSX host. This may be a requirement for Vista/Win7 hosts though. We are still doing testing.

Alex