Teensy 4 multi-pin TDM

Thank you to give some order to this code,because those amps are hard to setup for the newbie i am,
concretely,the result is the same,i'm talking about the tdmB1+2 stuff because the tdm1+2 always worked alright.
Let's say,if if set the amps 10+11 from input1,the bad sound begin after (0.1f),if i stay at (0.1f) i can't hear any of the input,that's weird
and those settings does'nt do any troubles with the tdm1+2,strange.
The amp16 that lead the sine in tdmB was not at (0.5f) in your code,so there was no sound,so i corrected.
I don't think the display is involved in the troubles for now,i will try with another cs42448 to see...:unsure:
I want also to be sure about the teensy 4.1 pins,as shown at the pjrc site:

Teensy 4.1 pinout.jpg


Pin6 (the input of tdmB) is labelled OUT1D,isn't it weird?
Pin38 is IN1,the same as Pin8,i'm confused,please tell me what really is...
 
Last edited:
Well,in dispite of these questions on teensy 4.1 pins,i'm glad to tell you i've solved all my problems,
it was because i just downloaded your fork just before you updated it,but i had the intuition that something was missing in the
library,teeling me you didn't have the same library update as I.
:cool:(y)
 
Glad you’ve got it working. Yes, that’s the trouble with trying out some of these bleeding edge libraries, an essential update appears and you don’t know about it…

On the pin names, it is a bit confusing. SAI1 has 5 pins, which Paul has labelled OUT1A, OUT1B, OUT1C, OUT1D and IN1. OUT1A and IN1 are fixed direction pins, but the others could also be named IN1D, IN1C and IN1B - note the reverse order of the letters. So when you connect OUT1D as an input, it’s really IN1B.

On pin 38 being marked as IN1, note that the text is grey, which means it’s possible to re-map it for that use, if for example you wanted to use TX2. I’ve never needed to, so I’d have to Google how if I did :)
 
Thanks for these precisions,i think i will transform a teensy 4.1 picture with all the new infos,help for me to have
an understanding vision of TDM & Co.
i suppose the audio editor haven't yet a united version that include multi TDM and USB multi channel
to wire them together or am i wrong?
 
There wasn't (apart from one I made which has a bunch of other stuff in development) ... but there is now. I think this just works if you unzip and drop it into the gui folder alongside the existing index.html, which makes it easy to switch back and forth.
 

Attachments

  • index-with-multi-TDM-and-USB.zip
    45.9 KB · Views: 23
Some images of my test system in action. A pair of CS42448 PCBAs stacked up and wired to a Teensy 4.1:
View attachment 35393

Modifications made to each board. The one underneath; note
  • zero-ohm link fitted to R20 to route 3.3V to IC1
  • I²C pull-ups fitted at IC1 pins 3 and 7, pulled up to pin 2
  • AD0/1 wired on IC1 pins 8 and 1, to GND at pin 4
  • poor view of clock wiring - see next image!
View attachment 35394

The one on top. Similar mods but:
  • You can see the wiring to route LRCLK and BCLK to the ADC and DAC together
  • No pull-ups, those are on the other board
  • AD1 is wired to 3.3V, so the address is 0x4A
View attachment 35395

Test topology:
View attachment 35396

Scope output. Yellow trace is from wav10 (TDMB_O port 14), magenta is wav6 (TDMA_O port 10) wired externally to TDMA_I port 10, and measured at TDMB_O port 10.

View attachment 35397
Hello! sorry for the too beginner question, I am connecting one CS42448 board and teensy 4.1 according to here, but the configuration is always failed, should I add pull-up circuit as you did? I checked my wiring several times and it should be all correct.
 

Attachments

  • IMG_1560.jpg
    IMG_1560.jpg
    365.1 KB · Views: 14
Hi @h4yn0nnym0u5e, thank you for answering some basic questions from me in private conversation, as you suggested some of them should go to public.

May I know is your PCM library support USB audio multichannel? I am not experienced enough to distinguish if USBoct and TDM inputs are both for USB input? (And I think in every customized libraries they are named differently)

Also can you show me how to properly install your library? Btw I found on max there are two libraries addresses, the global one and a local one, maybe that is a problem too.

Thank you so much.
 
Hi @Weiweiweiwear

For the most part, every Audio library object is independent of every other. The only exceptions are the hardware I/O objects, where the same on-chip peripheral or pin is used to implement two different interfaces. An example of this is the TDM and I2S objects, which both use the SAI1 hardware; this is shown when you use the Design Tool - if you try to place both, a warning triangle appears showing the clash. The info pane usually tells you, as well. However, TDM2 and I2S2 are independent (they use SAI2) and thus don't clash. USB I/O is independent of either of those, and can be added to a design along with TDM/TDM2 or I2S/I2S2 objects.

If you grab the attachment from this post, unzip and drop the html file into your library folder at Audio/gui (not sure where that will be on a Mac), then open it, you should be able to make designs with both multi-TDM and multi-channel USB, and warning triangles will appear if you try something that's impossible. Here's an example with quite a lot of audio I/O co-existing:
1728639367119.png

C++:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AsyncAudioInputSPDIF3    spdif_async1;   //xy=253,40
AudioInputI2S2           i2s2_1;         //xy=270,345
AudioInputTDM            tdm1;           //xy=271,187
AudioInputUSBOct         usb_oct1;       //xy=271,506
AudioOutputTDM           tdm2;           //xy=513,503
AudioOutputSPDIF3        spdif3_1;       //xy=517,41
AudioOutputI2S2          i2s2_2;         //xy=516,346
AudioOutputUSBOct        usb_oct2;       //xy=526,181


// GUItool: end automatically generated code

To install, I would suggest you start by cloning my repository into your local libraries folder. You can then switch branches to feature/multi-TDM. Then follow most of the instructions on @alex6679's repo, except the changedGUI section - for that, continue to use the html attachment I discussed earlier, as it has both sets of objects.

It is entirely normal to have a global (or Teensyduino-installed) and local library available. The Arduino IDE should prefer the local one over the global, and if you turn verbose compilation on you should find a message about multiple copies and which one was chosen. Not sure how this gets managed if you're using a different IDE.
 
Back
Top