Two audio boards on a 4.1

SteveSFX

Well-known member
Hi people

Is it feasible to run 2x Teensy 4.1 audio SGTL5000 boards off the same 4.1?

I know you can't 'stack' them, but is that just asking too much of the processor and with too many shared pins?
 
Yes - there's various threads and web pages around which give more-or-less comprehensive information on how to do it. The info pane for the QuadI2S objects in the Design Tool is a good starting point. The Teensy 4.x can comfortably manage 4i4o.

Note that much of the advice refers to Revision C (Teensy 3.x) or D (Teensy 4.x) adaptors. There's a gotcha with the Revision D2 adaptors, in that they can't have their I²C address changed, so I'd recommend getting at least one Rev D. The D2 was created due to supply issues with the SGTL5000, and I don't know if that's been resolved.

You need to
  • Hardware changes:
    • move DIN and DOUT to different pins
    • change the I²C address of one of the audio adaptors
  • Software
    • use AudioInputI2SQuad and AudioOutputI2SQuad objects
    • use two SGTL5000 control objects
    • use setAddress(HIGH) on one of the control objects before you use any other functions
 
Ah OK thanks. Yes, the changing i2c address is probably the biggest issue then (as in... not possible )
 
If you have the rev D2 audio board, it's usable for channels 1-2 (because the I2S address is fixed). You'll need rev D (with the pads to configure I2C address) for channels 3-4 or channels 1-2.

You definitely can use rev D2 and rev D together to get 4 channels. Or two rev D. The only combination that can't work** is two rev D2, because rev D2 can't be configured for channels 3-4.

Rev D2 was only made in the first half of 2023, due to chip shortages at that time. By mid-2023, all new audio shields shipped by PJRC were again rev D. Some distributors may have sold lingering D2 stock later in 2023.

CPU-wise, Teensy 4.1 can easily handle 4 audio channels. Even Teensy 3.2 could do this. The earlier rev B and rev C audio shields meant for the Teensy 3.x boards also had the I2C address pads and pads to separate the other I2S data. Many people did indeed build 4 channel audio projects on Teensy 3.2 with those earlier audio shields. Of course Teensy 4.1 is ~11X faster than Teensy 3.2, so you can do much more, or run CPU-heavy effects like the ladder filter which couldn't possibly run on Teensy 3.2 and uses about half the CPU on Teensy 3.6, but Teensy 4.1 can indeed run 4 of those.



** - use of two rev D2 could theoretically be made to work by wiring up the 2nd audio shield's SDA and SCL to a different I2C port and editing the code to use it, or by use of a signal mux chip, or a number of other ways of dealing with conflicting I2C addresses. But none of those are recommended. Just get the rev D audio shield for channels 3-4.
 
If you have the rev D2 audio board, it's usable for channels 1-2 (because the I2S address is fixed). You'll need rev D (with the pads to configure I2C address) for channels 3-4 or channels 1-2.

You definitely can use rev D2 and rev D together to get 4 channels. Or two rev D. The only combination that can't work** is two rev D2, because rev D2 can't be configured for channels 3-4.

Rev D2 was only made in the first half of 2023, due to chip shortages at that time. By mid-2023, all new audio shields shipped by PJRC were again rev D. Some distributors may have sold lingering D2 stock later in 2023.

CPU-wise, Teensy 4.1 can easily handle 4 audio channels. Even Teensy 3.2 could do this. The earlier rev B and rev C audio shields meant for the Teensy 3.x boards also had the I2C address pads and pads to separate the other I2S data. Many people did indeed build 4 channel audio projects on Teensy 3.2 with those earlier audio shields. Of course Teensy 4.1 is ~11X faster than Teensy 3.2, so you can do much more, or run CPU-heavy effects like the ladder filter which couldn't possibly run on Teensy 3.2 and uses about half the CPU on Teensy 3.6, but Teensy 4.1 can indeed run 4 of those.



** - use of two rev D2 could theoretically be made to work by wiring up the 2nd audio shield's SDA and SCL to a different I2C port and editing the code to use it, or by use of a signal mux chip, or a number of other ways of dealing with conflicting I2C addresses. But none of those are recommended. Just get the rev D audio shield for channels 3-4.

Hi. Sorry for digging up an older thread..

Are 4 channels (2x Audio boards) the maximum or can these be stacked further or is this limited by the addressing on the board itself?

Could 6 or 8 channels be implemented for example?
Or would a different IC be more suitable?

I noticed that the CS42448 has now been discontinued which I was hoping to use for a project

Are there any alternatives that would be suitable and how easily could this be integrated in to the existing smart audio libraries?

I am ideally looking for 16 channels either in a single project or multiple projects that can work together to produce 16 channels of audio IO.

Also, I can't seem to locate the pads / method of how to uniquely address each audio board on the site. Is this done physically on the board or in software? If on the board itself, where is this located and how many potential addresses are available per teensy4.1 board?

Or is this what h4yn0nnym0u5e was mentioning about the D-in and D-out pin changes? Would this mean that potentially there could be as many channels as pins available as there are on the teensy, or is this on the audio board (apologies, I am a little unclear on how this is achieved and what limitations there are for this)


Thanks in advance.
 
Last edited:
If using the PJRC audio adaptor (2i2o), a maximum of 3½ boards can be used, but it gets increasingly tricky to do after the first two.

The "main" Teensy I²S interface (the various Audio???I2S objects) has a maximum of 5 data pins (7, 32, 9, 6, 8), and there must be at least one input (pin 8) and one output (pin 7) - the other 3 can be allocated to either role. The secondary interface (Audio???I2S2 objects) has just one input and one output (pins 5 and 2).

The other issue is the I²C control interface. The SGTL5000 can only have two addresses, so to use more than 2 audio adaptors requires use of another Wire port, which is not catered for by the AudioControlSGTL5000 objects so you're into editing the library.

The Rev D audio adaptor does have pads to change the I²C address and patch the data signals:
audio-adaptor-mods.png


Either way, I²S is not a good choice for high I/O counts, you really need TDM. Even then, there's no easy way to get to 16 channels (I'm assuming you mean 16i16o here) at the moment.

The "get you going" option is to get a couple of the cheap CS42448 boards from AliExpress, which will give you 12i16o. It's not completely trivial to make this work, as they're not ready to go out of the box - you need to do some configuration to select their I²C addresses and add pull-ups. Again there's a limit of 3½ boards, but it's easier because they can have 4 different I²C addresses, so the control aspect is simpler; you could make a 24i24o system. A couple of relevant forum threads can be found here and here. I'd expect CS42448 boards to remain available for a little while, as last orders were June 2024 and last deliveries will be September 2025; after that stocks will run down, of course.

In the longer term, this project looks as if it's going to be very interesting. Changing your software over to using that hardware should simply be a matter of using a different control object - all the TDM stuff will be exactly the same as for a CS42448-based system.

The Design Tool info pane shows which pins are needed for the various clocks and data expected by each of the library objects you put in your design. That and the audio adaptor product page give a wealth of information, and you need to read and understand them pretty thoroughly to get a successful outcome.
 
If using the PJRC audio adaptor (2i2o), a maximum of 3½ boards can be used, but it gets increasingly tricky to do after the first two.

The "main" Teensy I²S interface (the various Audio???I2S objects) has a maximum of 5 data pins (7, 32, 9, 6, 8), and there must be at least one input (pin 8) and one output (pin 7) - the other 3 can be allocated to either role. The secondary interface (Audio???I2S2 objects) has just one input and one output (pins 5 and 2).

The other issue is the I²C control interface. The SGTL5000 can only have two addresses, so to use more than 2 audio adaptors requires use of another Wire port, which is not catered for by the AudioControlSGTL5000 objects so you're into editing the library.

The Rev D audio adaptor does have pads to change the I²C address and patch the data signals:
View attachment 36083

Either way, I²S is not a good choice for high I/O counts, you really need TDM. Even then, there's no easy way to get to 16 channels (I'm assuming you mean 16i16o here) at the moment.

The "get you going" option is to get a couple of the cheap CS42448 boards from AliExpress, which will give you 12i16o. It's not completely trivial to make this work, as they're not ready to go out of the box - you need to do some configuration to select their I²C addresses and add pull-ups. Again there's a limit of 3½ boards, but it's easier because they can have 4 different I²C addresses, so the control aspect is simpler; you could make a 24i24o system. A couple of relevant forum threads can be found here and here. I'd expect CS42448 boards to remain available for a little while, as last orders were June 2024 and last deliveries will be September 2025; after that stocks will run down, of course.

In the longer term, this project looks as if it's going to be very interesting. Changing your software over to using that hardware should simply be a matter of using a different control object - all the TDM stuff will be exactly the same as for a CS42448-based system.

The Design Tool info pane shows which pins are needed for the various clocks and data expected by each of the library objects you put in your design. That and the audio adaptor product page give a wealth of information, and you need to read and understand them pretty thoroughly to get a successful outcome.


Thanks for the feedback!

I can see now where I was getting things wrong.

All the best
 
Back
Top