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

Thread: Streaming audio through USB using Teensy 4.1 and Digilent Pmod I2S2 board

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    4

    Streaming audio through USB using Teensy 4.1 and Digilent Pmod I2S2 board

    Hi,

    I am a beginner.

    I tried to use Teensy 4.1 and Digilent I2S DAC board to achieve USB audio streaming but failed. I just use the example in arduino which named "PassthroughUSB". The USB audio interface is ok but there isn't any sounds come out. The DAC board use cs4344 DAC chip. I guess the problem is in the I2S protocol but I don't know what should I do because I don't know where can I modify the code about I2S communication in this example, there are only several "audioconnection" command in this example. By the way, I have a question that whether the USB audio mode in this example is asynchronous or synchronize? How can I achieve asynchronous mode in Teensy 4.1?

    I would appreciate if someone can give me some suggestion.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,711
    Let's first look at how you connected the hardware. Over and over on this forum we've had people connect various I2S chips. They almost always work once connected properly. Mistakes or misunderstandings about the wiring are by far the most common problem.

    Can you show us photos? Also a link to the specs on this hardware would help. If the problem is as simple as something not wired up properly, the only way we're going to be able to help is if we can see the problem. Please try to get a camera angles as close as you camera can focus, so we can see where all the wires actually connect.

  3. #3
    Junior Member
    Join Date
    Sep 2020
    Posts
    4
    Click image for larger version. 

Name:	微信图片_20200906011507.jpg 
Views:	18 
Size:	82.4 KB 
ID:	21632Click image for larger version. 

Name:	微信图片_20200906011512.jpg 
Views:	21 
Size:	47.3 KB 
ID:	21633Click image for larger version. 

Name:	微信图片_20200906011516.jpg 
Views:	17 
Size:	60.0 KB 
ID:	21634Click image for larger version. 

Name:	微信图片_20200906011520.jpg 
Views:	13 
Size:	66.6 KB 
ID:	21635
    Thank you for your reply!
    Here are my connections.
    Best wishes

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,711
    But here are quick answers to your questions.

    Quote Originally Posted by KANTA View Post
    I don't know where can I modify the code
    Generally you should not modify the I2S code. The only things that would normally be configured are done by choosing a different I2S output object. See the design tool for the complete list of all features in the library. Of course you can edit the library source code, but I would definitely not recommend trying that until you've got hardware working. The hardware is extremely configurable for all sorts of non-I2S protocols, and NXP's documentation can be quite difficult to understand.

    The PassthroughUSB example code using AudioOutputI2S is the correct way to use this sort of DAC chip. But you might delete AudioControlSGTL5000 and the lines using it, since you have a plain DAC chip rather than a complex chip like SGTL5000 with lots of configuration.


    whether the USB audio mode in this example is asynchronous or synchronize? How can I achieve asynchronous mode in Teensy 4.1?
    It uses asynchronous mode, as defined by the USB audio class (version 1). An asynchronous rate feedback endpoint is used to inform the host of the rate Teensy wishes to receive data. Again, you have all this source code on your machine, but editing it before you have a working system would be foolhardy. USB is really complicated and the audio code is particularly difficult to understand.

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,711
    Move the orange wire to Teensy 4.1 pin 7.

  6. #6
    Junior Member
    Join Date
    Sep 2020
    Posts
    4
    Solved! Thank you!

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,711
    Glad you got it working.

    Now if you really want to dive into editing that complicated low-level code, at least you'll be able to hear the effects you're having.

  8. #8
    Junior Member
    Join Date
    Sep 2020
    Posts
    4
    Hi,

    I found that when I stream 24bit/96KHz, after a period of normal playback, continuous popping sounds will begin to appear. Can Teensy 4.1 automatically recognize the sampling rate? Or does it fix the sampling rate at a certain value, such as 44.1KHz?

    Best wishes

  9. #9
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,711
    It only supports 44.1 kHz, and it tells your PC to only send 44.1 kHz. Even if you're playing 96 kHz material, your PC must convert to 44.1 kHz before sending to Teensy. The flawed conversion you're hearing isn't happening on Teensy.

Posting Permissions

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