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

KANTA

New member
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.
 
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.
 
微信图片_20200906011507.jpg微信图片_20200906011512.jpg微信图片_20200906011516.jpg微信图片_20200906011520.jpg
Thank you for your reply!
Here are my connections.
Best wishes
 
But here are quick answers to your questions.

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.
 
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.
 
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
 
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.
 
Super quick question for Paul: can someone use several of these for multiple I/o channels and teensy 4.2? Or is there a better solution for, say, 4 in/4 out or beyond?
 
Are you asking about connecting the hardware mentioned in msg #3?

I don't know much about that hardware. A quick Google search turned up this page? Is this the right thing?

https://digilent.com/reference/pmod/pmodi2s2/reference-manual

This sure looks like standard I2S. I see it has a jumper to configure which mode. To use more than 1 with Teensy, you would want to configure it for slave mode, where all the clock signals are inputs.

I believe you could connect 3 of these to Teensy 4.1. The first 2 would connect to the main I2S port, running in quad input & output. The 3rd would connect to Teensy's second I2S port, which only supports stereo.
 
Thanks, Paul! I’m trying to make my own eurorack modules with a teensy at the heart of each- different things like fx processors or more esoteric nonsense, maybe three or four modules. For those that would benefit by having 4in/4out or beyond, was wondering best path to go down- because I’d like to design a couple of pcbs and have one main processor board broken out, which press fits to a generic I/o board that pots and buttons and switches and jacks are always mounted to. First step is to figure out an audio system that goes beyond the audio shield and its piggyback/physically stacking orientation. I saw you had something in 2017 for teensy 3.X that used a cirrus audio chip for 6 in/8 out and something like that would be ideal- but I don’t see a version for 4.X teensies.
 
The teensy 4.1 will work with multiple dacs as discussed. However, USB audio support is only stereo at the moment (2 in/2 out). Many users have goals to add more channels. I think one might have gotten 4/4 working but didn't share the code. IIRC
 
This thread may be worth a look. There should be links to various repositories which update the USB core code to more channels and higher data rates, plus additional Audio objects which can make use of that.

There are definitely a few issues to iron out, but you may find it works for you. Unfortunately the prime mover and expert on this, mcginty, seems to have gone AWOL in 2023, and though I’ve contributed some code, I’m at a bit of a loss with the super low level USB debugging that’s needed at this point.
 
Back
Top