USB audio class 2.0 in ASF?

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

I'm working on a project that needs to implement USB 2.0 audio class functionality. In the ASF tree, I don't see an audio folder or any udi_audio.c or udi_audio.h "class driver" folders alongside the others like, cdc, composite, in the ASF tree.

Googling however, for audio_udi.* returns a udi_audio.c and associated files in an android code repo (for Atmel). The code in the files look like the other class-specific files in ASF for the available class drivers; udi_vendor, udi_cdc, etc., except for audio class.

Any good reason not to use these "class drivers ?" If there is a more suitable source tree to use, I would greatly appreciate any assistance in locating it.

I am using AS 6.1 with ASF 3.7.3 on a AT32UC3A364

Thanks very much!

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

There has been some work done internally on this, but it looks like the bug entry has stalled for some reason. I've poked the implementer to see if I can get things moving again to get it integrated into ASF.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Hi Dean. Thanks. That we be useful. Was the bug just a generic placeholder to integrate into the latest release or a real bug? I ask because I've started using what I could find to begin my development.

-Wade

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

An enhancement request, not a bug (sorry, I have bad habits from BugZilla and refer to both enhancements and bugs as just bugs :P).

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Hello, Dean! Did you ever hear anything back from your poked implementer about USB Audio for ASF? :wink:

I found the same android repository that @wdawson is talking about, and I've been able to get a USB Audio speaker recognized by Windows, but the isochronous pipe seems to get stalled somewhere in the udi_audio_stream_buf[] scheme of things in udi_audio.c -- I only get one call to UDI_AUDIO_PROCESS_EX() (aka main_audio_out_process()) per pipe. Otherwise, hey, it's a great start to (re)inventing Audio USB for ASF! But I sure would like to know if there are some up-to-date source files I could start with. (There were compile errors, incompatible parameter lists, etc., that I worked around.)

(emoticon for hopeful grin)

-- Bob Stein, Avionica

P.S. I'm using Atmel Studio 6.1.2730 SP2 for an ATSAM3X8E on an Arduino Due.

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

Unfortunately the branch is still stuck in limbo; I believe the code is functional, but missing polish and the engineer assigned is currently on higher priority duties. I've re-requested it be finished up and merged, but I wouldn't expect it to happen soon.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

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

Thank you, Dean! Appreciate the news, and good luck with all of that. I wanted to report that I did get the code working after fixing (or working around) a race condition.

This is in udi_audio_stream_out_start() at the bottom of udi_audio.c.

Old:

if (!udd_ep_run(UDI_AUDIO_EP_OUT,
				true,
				udi_audio_stream_buf[udi_audio_buf_write_index],
				UDI_AUDIO_EPS_SIZE,
				udi_audio_stream_samples_received)) {
	return false;
}
udi_audio_stream_buf_state[udi_audio_buf_write_index] = AUDIO_BUFFER_BUSY;

New:

udi_audio_stream_buf_state[udi_audio_buf_write_index] = AUDIO_BUFFER_BUSY;
if (!udd_ep_run(UDI_AUDIO_EP_OUT,
				true,
				udi_audio_stream_buf[udi_audio_buf_write_index],
				UDI_AUDIO_EPS_SIZE,
				udi_audio_stream_samples_received)) {
	udi_audio_stream_buf_state[udi_audio_buf_write_index] = AUDIO_BUFFER_IDLE;
	return false;
}

The problem with the old code was that after setting the callback to udi_audio_stream_samples_received() and before setting the state to AUDIO_BUFFER_BUSY, the udi_audio_stream_samples_received() function was immediately called, setting the state to AUDIO_BUFFER_FULL. This of course was promptly overwritten with AUDIO_BUFFER_BUSY, and there the buffer-state remained forever stuck. Another approach might be to bracket the statements with cpu_irq_save/cpu_irq_restore.

I haven't checked the other state changes for race conditions yet, but this at least got the pipe up and running for us. Now working on audio quality issues.

-- Bob Stein, Avionica

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

Trying to run that code on SAME70 Explained board..no luck yet..

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

I have usb audio device recognised in asf 4 project...just modified enable and disable functions in hid mouse example , putting audio descriptors instead of mouse ones too