Notifications
Clear all

USB Audio Out -How?

5 Posts
3 Users
0 Likes
314 Views
(@fishbone)
Member
Joined: 1 year ago
Posts: 54
Topic starter  

Can somebody shed some light on how digital audio data is sent out on usb-c?  I have been researching this for about a week and still have no clue.  I understand in general that a usb has D+ and D- pins on which digital data may be sent.  I understand a bit about I2S standard and how it is used to send digital audio data.  I had assumed I2S data could be sent across usb - but it is apparently MUCH more complicated than that.  I2S requires 3 data lines but usb has 2 data lines.  As best as I can tell, the I2S data has to be formatted into a format such as PCM (I think this is what a codec does).  Then a USB audio class allows you to send that data over usb. 

I may have got some of that wrong, but it seems unnecessarily complicated considering you have digital I2S data on one side of a usb connector and just want to send it to the other side. 

Then again, I may be missing something very fundamental.  If any of you guys can add some context, that would be great!

 

Fish 


   
Quote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6865
 

@fishbone I just got some USB-C test gear this week, so here is the information. You will need a USB-C breakout board, after I make coffee and wake up I will see if I can dig one out and get an Amazon link.

IMG 8198
IMG 8199

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@fishbone)
Member
Joined: 1 year ago
Posts: 54
Topic starter  

@zander very interesting.  I didn't know there were operating "modes".  Are the modes configured in software (I know esp32 uses something called TinyUSB that allows for using it as HID, Mass storage, etc.  I bet that's what that is)?  I know on my Samsung Galaxy phone I use the same usb-c port to charge, send music and data.  My current project has it wired like this:

image

This is pretty standard for esp32 dev boards.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6865
 

@fishbone Sorry, I can't answer your questions with any authority. What I showed you is the documentation for a test tool I just got. We had a robust discussion a few weeks ago about the Pi5 and it's use of 5A so I did some research and found two test tools to help me understand what USB-C is all about.

I think there is a USB-C web site or Wiki that will answer your questions.

I am enclosing a couple more pics that show some stuff not included in the first pics. NOTE the comments around 'flipping'. I always thought USB-C was fully symmetrical, but of course there is one (at least?) exception. Not sure if that affects you, but there it is.

As far as Tiny USB, there are 40 libraries that start with Tiny plus a few with tiny elsewhere in their name. They are not all the same author, I think Tiny means lightweight, or simple. They are probably versions of full libraries that only expose the most common API parts.

IMG 8203
IMG 8202
IMG 8204

 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
 John
(@jhb)
Member
Joined: 2 months ago
Posts: 12
 

While I can't make any suggestions on what you should do, I think you should really be working at a much higher level than what is on the USB physical layer itself.  Unless you really want to torture yourself.

There's a lot of protocol details you probably don't want to look at.  For example, look at the properties of a USB device in Windows Device Manager (Start --> Device Manager --> Universal Serial Bus, right-click on something, select Properties, and go to Details tab).  Click on the Properties tab and there will be a list of dozens (or hundreds) of properties that the USB device and PC have negotiated over the D+ and D- wires when you connected the device.  What I'm saying is that there is a lot more to USB than meets the eye!

I would look to find some kind or driver or library to do the heavy-lifting of anything dealing with the physical layer itself.  Sorry I can't be of more help, but I started going down that route myself and got totally snarled.  On the other hand, I have messed around with Linux a bit and found something called udev (for USB Devices).  You can put entries in a table to tell the kernel which driver to load, based on the device's Vendor ID (VID), Product ID (PID), even the serial number.  But that was around 5 years ago that I worked with that, so I might not be remembering everything rightly.

This post was modified 2 months ago 2 times by John

   
ReplyQuote