Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 11 of 11

Thread: 4CH IN - 4CH OUT USB Soundcard on teensy 4.1

  1. #1
    Junior Member
    Join Date
    Apr 2021
    Posts
    6

    4CH IN - 4CH OUT USB Soundcard on teensy 4.1

    Hi everyone,
    I'll start my project to programming the teensy 4.1 to be apearing as a 4ch sound card.
    Before starting I wanted to know if anyone achieved to transform any teensy on 4ch soundcard or have any advice to achieve that.
    I checked the teensy's code and I think I'll start to look on the usb_audio.cpp or maybe usb_desc.c and usb_desc.h files.
    If someone have any clues it'll be welcomed.

    In the future the teensy will be connected to a codec and will exchange TDM signals.

    Let me know if you have anything.

    Best regards

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,493
    Maybe subscribe to this other thread about attempts to go to 8 channels.

    https://forum.pjrc.com/threads/60557...8i80-USB-Audio

  3. #3
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Hi Paul,
    Thank you for this link it defenitely have some good info inside.
    But he didn't share the code he develloped right ?

    By the way, 8in8o is a little bit much for me because I want to keep space for other datas like sensors.
    So i'll go with 4I4O, I'll post messages of my progression.

  4. #4
    Junior Member
    Join Date
    Apr 2021
    Posts
    2
    It appears that the op of that other thread is gone.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,493
    Quote Originally Posted by elromulous View Post
    It appears that the op of that other thread is gone.
    That other thread is still the best place to discuss more-than-stereo USB audio, because everyone who's interested is already following that thread.

  6. #6
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Hi Paul,
    I read all the USB device Class definition for audio device and I found something that I don't understand concerning the usb_desc.c file.
    In the #ifdef AUDIO_INTERFACE section, when the Standard AS Interface Descriptor is decribed for the INTERFACE 3 (Received from PC)
    :
    Code:
    // Standard AS Interface Descriptor
    	// USB DCD for Audio Devices 1.0, Section 4.5.1, Table 4-18, page 59
    	// Alternate 0: default setting, disabled zero bandwidth
    	9,					// bLenght
    	4,					// bDescriptorType = INTERFACE
    	AUDIO_INTERFACE+2,			// bInterfaceNumber
    	0,					// bAlternateSetting
    	0,					// bNumEndpoints
    	1,					// bInterfaceClass, 1 = AUDIO
    	2,					// bInterfaceSubclass, 2 = AUDIO_STREAMING
    	0,					// bInterfaceProtocol
    	0,					// iInterface
    	// Alternate 1: streaming data
    	9,					// bLenght
    	4,					// bDescriptorType = INTERFACE
    	AUDIO_INTERFACE+2,			// bInterfaceNumber
    	1,					// bAlternateSetting
    	2,					// bNumEndpoints
    	1,					// bInterfaceClass, 1 = AUDIO
    	2,					// bInterfaceSubclass, 2 = AUDIO_STREAMING
    	0,					// bInterfaceProtocol
    	0,					// iInterface
    It's indicated that the interface in Alternate 1 is using 2 endpoints I don't undestand why.
    Can you explain it to me ?
    I can't see why there are 2 endpoint associated to that interface (Received from PC) and only 1 in the interface 2 (Transmit to the PC).

    Thank you.

  7. #7
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    I also have a question concerning the version of the USB used.
    In the Class-specific AC Interface Header Descriptor :
    Code:
    	// Class-specific AC Interface Header Descriptor
    	// USB DCD for Audio Devices 1.0, Table 4-2, page 37-38
    	10,					// bLength
    	0x24,					// bDescriptorType, 0x24 = CS_INTERFACE
    	0x01,					// bDescriptorSubtype, 1 = HEADER
    	0x00, 0x01,				// bcdADC (version 1.0)
    	LSB(62), MSB(62),			// wTotalLength
    	2,					// bInCollection
    	AUDIO_INTERFACE+1,			// baInterfaceNr(1) - Transmit to PC
    	AUDIO_INTERFACE+2,			// baInterfaceNr(2) - Receive from PC
    It's indicated that the rev 1.0 of the USB specification is used, does it means the teensy 4.1 is using the USB1.0 standart so the max speed is 12 Mbit/s in Full speed mode ?
    If we want to reach the 480 Mbit/s of the USB 2 do we have to change the bcdADC to 2.0 and follow the new document rev2 of the USB device Class definition for audio device ?

    Thanks again.

  8. #8
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,668
    No, the speed is 480MBit/s.

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,493
    Quote Originally Posted by VP.dplns View Post
    It's indicated that the rev 1.0 of the USB specification is used, does it means the teensy 4.1 is using the USB1.0 standart so the max speed is 12 Mbit/s in Full speed mode ?
    No. It is audio class 1.0, specifically this document:

    https://www.usb.org/sites/default/files/audio10.pdf


    Quote Originally Posted by VP.dplns View Post
    I read all the USB device Class definition for audio device
    Really?


    Quote Originally Posted by VP.dplns View Post
    It's indicated that the interface in Alternate 1 is using 2 endpoints I don't undestand why.
    Can you explain it to me ? I can't see why there are 2 endpoint associated to that interface (Received from PC) and only 1 in the interface 2 (Transmit to the PC).
    We are using asynchronous mode, described in 3.3.1 on page 19.

    See 3.7.2.2 "Isochronous Synch Endpoint" on page 32 and 4.6.2.1 "Standard AS Isochronous Synch Endpoint Descriptor" on page 63-64.. Also in the USB 2.0 spec, read 5.12.4.2 "Feedback" starting on page 73.

    The extra endpoint transmits explicit asynchronous rate feedback to the host. In this mode, the host is responsible for adjusting its transmit rate to match the device's requirements.

  10. #10
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Thank you for your answers Frank B and Paul.
    No. It is audio class 1.0, specifically this document:

    https://www.usb.org/sites/default/files/audio10.pdf
    So what are the difference beetween those :
    http://dl.project-voodoo.org/usb-aud...20%20final.pdf
    https://www.usb.org/document-library...ters-agreement

    Really?
    Yes, I'm trying to understand every line of the usb_desc.c for the audio part.

    Click image for larger version. 

Name:	Doc USB photo.jpg 
Views:	15 
Size:	78.6 KB 
ID:	25164

    We are using asynchronous mode, described in 3.3.1 on page 19.

    See 3.7.2.2 "Isochronous Synch Endpoint" on page 32 and 4.6.2.1 "Standard AS Isochronous Synch Endpoint Descriptor" on page 63-64.. Also in the USB 2.0 spec, read 5.12.4.2 "Feedback" starting on page 73.

    The extra endpoint transmits explicit asynchronous rate feedback to the host. In this mode, the host is responsible for adjusting its transmit rate to match the device's requirements.
    Wow thank you very much for those informations. I'll check these specifical parts.

  11. #11
    Junior Member
    Join Date
    Apr 2021
    Posts
    6
    Hi everyone,
    I have another question about the Maximum packet size.
    I don't understand how to choose the bMaxPacketSize0 (equal to 64 bytes?) and wMaxPacketSize (equal to 180 bytes?).
    In the doc they say it determined by the audio bandwith constraints but I don't see the relation.
    I didn't find that much info on the doc about that.
    Does somebody have any clues on that ?
    Thank you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •