Teensy 4.0 I2S connections to TAS2770

Status
Not open for further replies.

cjwu382

Member
Hi,

I'm hoping to use a Teensy 4.0 to drive a TAS2770 digital input mono class-D audio amplifier (https://www.ti.com/product/TAS2770#tech-docs), but am not sure how the I2S pins on the Teensy align. I'm new to audio so would appreciate the help.

On the TAS2770 I will need:

SDIN (TDM serial data input)
SDOUT (TDM serial data output)
FSYNC (word select)
SBCLK (TDM serial bit clock)

On the Teensy 4.0, I see pins:

MCLK1
MCLK2

BCLK1
BCLK2

LRCLK1
LRCLK2

S/PDIF IN
S/PDIF OUT

IN1
IN2

OUT1A
OUT1B
OUT1C
OUT1D
OUT2

MQSR
MQSL

Can anyone please suggest a connection scheme?
Also, is there a good place to find documentation on each of these pin functions on the Teensy?

Much appreciated!
 
SDIN (TDM serial data input) = OUT1A from teensy to SDIN of chip.
SDOUT (TDM serial data output) = No connection. Probably to a second amp chip for the second channel because this chip is mono (look at datasheet).
FSYNC (word select) = LRCLK1 is the same thing as FS...
SBCLK (TDM serial bit clock) = BCLK1

So I guess this chip doesn't use the MCLK? It has a PLL to create it, most likely. If it did need one it's on MCLK1.

Nice project... I'll check the datasheet for you when I get a chance. Hook these lines up and then run a file/example/audio/passthroughUSB sketch and it probably will work out of the box.
 
So I guess this chip doesn't use the MCLK? It has a PLL to create it, most likely. If it did need one it's on MCLK1.
Datasheet touts MCLK-free operation
Nice project... I'll check the datasheet for you when I get a chance. Hook these lines up and then run a file/example/audio/passthroughUSB sketch and it probably will work out of the box.

Well no, don't do that, that chip's logic signals are nominal 1.8V, abs-max 2.3V level, so first get some level shifting circuitry...

And don't forget the I2C interface you'll need that to program the registers, so bidirectional 3.3V <-> 1.8V level shifting is
needed for that bus too.
 
Thanks JayShoe and MarkT for the responses!

The TAS2770 datasheet says that "The SDOUT pin is used to transmit sample streams including speaker voltage and current sense, VBAT voltage, die temperature and channel gain", which I am interested in monitoring. Would it make sense to connect this to the IN1 pin on the Teensy?

Also, what's the difference between OUT1A, B, C and D?

Thanks MarkT for bringing up the level shifting. Yes, I'm looking into options for both the I2S and I2C buses.
 
Mark is right, you'll need a level shifter. Sorry for jumping the gun - I'm surprised to see this. I was just pointing out that *most* chips don't need much initialization to work with Teensy... Most chips will automatically detect the clocks and set things up out of the box for basic playback. That's my experience anyhow. Yes, I2C control is required once you want to get to the next phase of the design of your project.

The TAS2770 datasheet says that "The SDOUT pin is used to transmit sample streams including speaker voltage and current sense, VBAT voltage, die temperature and channel gain", which I am interested in monitoring. Would it make sense to connect this to the IN1 pin on the Teensy?

No. It's not an I2S stream is it? Without looking further I can't say for sure but that doesn't sound like an I2S stream from your quote. The IN1 pin is for I2S input (ADC). What device are you using? An EVM module or just a chip? Some off the shelf ebay board or something? Are you designing your own board?
 
The IN1 pin is for I2S input (ADC). What device are you using? An EVM module or just a chip? Some off the shelf ebay board or something? Are you designing your own board?

For starters, I'm planning to test with the TAS2770 Eval board, which has 3.3V to 1.8V level shifters: https://www.ti.com/tool/TAS2770EVM-STEREO
Eventually I'm planning to design my own board.

The SDOUT line from the TAS2770 is a TDM Serial Data Output, so I believe this does make it an I2S stream...

From an application note of the teensy microcontroller, it seems like the I2S buses support full duplex with I2S (https://www.nxp.com/docs/en/application-note/AN12090.pdf section 2.1, Figure 1), though it's still unclear to me if the IN1 and IN2 pins are these inputs... It seems like they are serial?
 
Last edited:
From an application note of the teensy microcontroller, it seems like the I2S buses support full duplex with I2S (https://www.nxp.com/docs/en/applicat...te/AN12090.pdf section 2.1, Figure 1), though it's still unclear to me if the IN1 and IN2 pins are these inputs... It seems like they are serial?

The Teensy exposes 2 "SAI" modules of the 3 on the chip (if my memory serves me correctly). SAI is just a fancy name for an I2S bus that is configurable in many different ways (I2S, TDM, etc). Check out this document that might help explain it (https://www.nxp.com/docs/en/application-note/AN12202.pdf).

SAI0 = OUT1A, OUT1B, OUT1C, OUT1D, IN1 + MC1, BCLK1, LRCLK1
SAI1 = IN2, OUT2 + MC2, BCLK2, LRCLK2

The direction is by way of the DSP, so it's coming out (OUT1) or going into the DSP (IN1). Your chip is an output device so it will only ever be connected to the output of the SAI port. Any additional information (monitoring, programming, debugging, etc) will happen on a different bus. It will be programmed via I2C (SDA0, SCL0).

With 90% certainty the default values of the DUT (device under test, aka TAS2770) will be automatically configured to I2S mode and the clocks will be automatically detected. So literally making the connections that I suggested in my first post would play music through your EVM. But don't hold me to that.. :)

The SDOUT pin of the DUT is an output of I2S/TDM so that you can daisy chain these things and get multichannel audio. Since it's a mono amp, it probably has registry configurations (via I2C) to send the second channel of the I2S stream (I2S is stereo) to the second device so it can operate in a stereo mode with 2 devices. You can safely ignore that pin. Even if you want stereo, you will probably be better off just daisy chaining the OUT1A pin from the Teensy. Then program the second device to the right slot to pickup the second channel of the stereo pair (I2S is stereo).

Yes, a GPIO pin might send that monitoring data maybe... Or possibly just monitor via I2C... Here is just one section of the register that might be of interest. This data is obtained via I2C.

TAS2770_monitor.png

So again.

SDIN (TDM serial data input) = OUT1A from teensy to SDIN of chip.
SDOUT (TDM serial data output) = No connection.
FSYNC (word select) = LRCLK1 is the same thing as FS...
SBCLK (TDM serial bit clock) = BCLK1

The datasheet confirms.... "MCLK Free Operation".

And then the I2C.

SDA of DUT = SDA0 of Teensy
SCL of DUT = SCL0 of Teensy

A total of 5 pins gets you going with the EVM. Assuming you powered it from another source, and removed/configured jumpers so the I2S and I2C is coming from the Teensy.

Is there a reason you chose this chip? There are a few others on TI's website that don't require the level shifter, and probably have other advancements too.
 
Last edited:
Maybe the audio library documentation can help answer some of these questions about which pins to use. All that documentation is in the design tool. It appears on the right side panel as you click on each object.

https://www.pjrc.com/teensy/gui/

All the input and output objects have a "Hardware" section (scroll down to see it) which documents which pins you use to connect the hardware when using that particular input or output. Assuming you will end up using the audio library, you should make sure you choose pins which the software will actually support. It's also a good idea to drag all the inputs and output you will use onto the canvas, even if you're not ready to design the rest of your audio processing. If any are incompatible, you'll see yellow triangles appear on the ones which conflict.

While it's theoretically possible to write your own audio driver-level code, which might give you access to using other pins or features, it's still a pretty good idea to plan your pin usage using the audio library design tool. It does support almost everything Teensy 4 can do and quite a lot of work has gone into the documentation and detection of incompatible combinations.
 
Thanks Jay and Paul for the help, I appreciate the time looking into this.

The SDOUT pin of the DUT is an output of I2S/TDM so that you can daisy chain these things and get multichannel audio. Since it's a mono amp, it probably has registry configurations (via I2C) to send the second channel of the I2S stream (I2S is stereo) to the second device so it can operate in a stereo mode with 2 devices. You can safely ignore that pin. Even if you want stereo, you will probably be better off just daisy chaining the OUT1A pin from the Teensy. Then program the second device to the right slot to pickup the second channel of the stereo pair (I2S is stereo).

I don't mean to beat a dead horse/apologies if misinterpreting something obvious, but the TAS2770 datasheet says that the SDOUT pin is used to transmit IV sense, VBAT, etc:
Capture.PNG
So as far as I can tell, I need to read the data from this pin to get these feedback signals. Can I not use the Teensy?

Is there a reason you chose this chip? There are a few others on TI's website that don't require the level shifter, and probably have other advancements too.
I'm using it in a production design with 1.8V logic to drive a coil actuator (not a speaker). I just want to use the Teensy for a quick breakout board to test some algorithms
 
Last edited:
cjwu382,

Take a look at "Table 23. TDM Voltage Sense Time Slot". Yeah, it looks like it's a TDM data stream but NOT I2S. Also looks like that information might not be accessible via I2C? IDK. Anyhow, this is above my pay grade. It would be up to you to figure out how to receive and process that TDM data stream. I have no idea what pin would be best. Some serial RX (receive) pin. It's not audio.

You may find help about that on TI's E2E forum. Good luck!

Jay
 
Teensy does support TDM protocol. Did you look at the design tool yet? On the left side, you should be able to see "tdm" and "tdm2" in both the input and output groups. Try clicking those, so you can see the documentation for them in the right-side panel.
 
Hey Paul, yes I know it does support TDM. But this TDM is not I2S, it's serial data. Things like speaker current, voltage sense, etc. The teensy audio library wouldn't support that out of the box, would it? It's metering data, not audio data.
 
Things like speaker current, voltage sense, etc. The teensy audio library wouldn't support that out of the box, would it? It's metering data, not audio data.

This really depends on what you mean by "support". The audio library certainly will give you access to these data streams as if they are streaming audio signals. So you could do things like run them into the analysis object to get RMS and/or peak measurements. Or even FFT. You could run the voltage and current into the multiplier object to compute audio-rate power (scaled to a normalized range, not absolute watts), than then run that into RMS and peak. You can also feed those streams into the queue object, to get access to the raw data from your program.

But if you're expecting some sort of input object that does something specific with that sort of data, then no. And in general, the audio library is about giving you a system where you can build your own audio system by creating instances of the many objects the library offers. So that's the sort of functionality you can expect. If you're not familiar with this, I highly recommend reading or watching the audio library tutorial so you can understand better how the software side is meant to work.

https://www.pjrc.com/store/audio_tutorial_kit.html
 
Thanks Paul! Is there any example code to get the raw output from the TDM stream? Didn't see any in the audio tutorial.
 
In the audio design tool, I also see an exclamation mark when I add both an i2s output and a tdm input - so can I not use both formats at the same time?
 
In the audio design tool, I also see an exclamation mark when I add both an i2s output and a tdm input - so can I not use both formats at the same time?

1) place a tdm input object into the audio design tool
2) look at the "info" section (towards the right-hand side of the audio design tool)
3) scroll down to the "Notes" section, where you'll find the following:

"Only one TDM input and one TDM output object may be used. The I2S hardware is used by TDM, so TDM objects may not be used together with I2S, SPDIF or PT8211."

Hope that helps . . .

Mark J Culross
KD5RXT
 
Status
Not open for further replies.
Back
Top