Different output between TDM1 and TDM2

Status
Not open for further replies.

Tengrii

Member
Hi all.

In connection with a hobby project, I have to make use of both TDMs which are built into Teensy 4.1. Using designer tool I have connected 4 DC signals with an amplitude 1 on both TDM on the same channels. I get the expected output on TDM1 but TDM2 gives me something completely different. I have tried with different amplitudes values even with minus values ​​too, it is as if TDM2 it has a different interpretation of data.
furthermore, TDM2 is offset by 2.5 us almost compared to TDM1. I have attached a picture with my scope measurements. I have used both analog and digital to eliminate that it is my measuring equipment that is wrong with, the outcome is the same.
What am i doing wrong? Does the TDM2 need to be initiated somehow to be working synchronised with TDM1?

On TDM1 I measure on pins 7 and 20
and on TDM2 I measure on pins 2 and 3.

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


// GUItool: begin automatically generated code
AudioSynthWaveformDc     dc2;            //xy=445.0000114440918,520.0000114440918
AudioSynthWaveformDc     dc1;            //xy=446.0000114440918,478.0000114440918
AudioSynthWaveformDc     dc3; //xy=446.0000305175781,560.0000133514404
AudioSynthWaveformDc     dc4;            //xy=446.0000114440918,601.0000152587891
AudioOutputTDM           tdm1;           //xy=813.0001068115234,735.0000915527344
AudioOutputTDM2          tdm2_1;         //xy=815.0000228881836,450
AudioConnection          patchCord1(dc1, 0, tdm1, 0);
AudioConnection          patchCord2(dc2, 0, tdm1, 4);
AudioConnection          patchCord3(dc3, 0, tdm1, 11);
AudioConnection          patchCord4(dc4, 0, tdm1, 14);
AudioConnection          patchCord5(dc1, 0, tdm2_1, 0);
AudioConnection          patchCord6(dc2, 0, tdm2_1, 4);
AudioConnection          patchCord7(dc3, 0, tdm2_1, 11);
AudioConnection          patchCord8(dc4, 0, tdm2_1, 14);
// GUItool: end automatically generated code




void setup() {
  AudioMemory(100);
  dc1.amplitude(1);
  dc2.amplitude(1);
  dc3.amplitude(1);
  dc4.amplitude(1);
 
  
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

TDMSammenligning.jpg
 
This is a how it looks when i use different amplitude values.

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



// GUItool: begin automatically generated code
AudioSynthWaveformDc     dc2;            //xy=445.0000114440918,520.0000114440918
AudioSynthWaveformDc     dc1;            //xy=446.0000114440918,478.0000114440918
AudioSynthWaveformDc     dc3; //xy=446.0000305175781,560.0000133514404
AudioSynthWaveformDc     dc4;            //xy=446.0000114440918,601.0000152587891
AudioSynthWaveformDc     dc5;
AudioSynthWaveformDc     dc6;
AudioOutputTDM           tdm1;           //xy=813.0001068115234,735.0000915527344
AudioOutputTDM2          tdm2_1;         //xy=815.0000228881836,450
AudioConnection          patchCord1(dc1, 0, tdm1, 0);
AudioConnection          patchCord2(dc2, 0, tdm1, 3);
AudioConnection          patchCord3(dc3, 0, tdm1, 6);
AudioConnection          patchCord4(dc4, 0, tdm1, 9);
AudioConnection          patchCord5(dc5, 0, tdm1, 12);
AudioConnection          patchCord6(dc6, 0, tdm1, 15);
AudioConnection          patchCord7(dc1, 0, tdm2_1, 0);
AudioConnection          patchCord8(dc2, 0, tdm2_1, 3);
AudioConnection          patchCord9(dc3, 0, tdm2_1, 6);
AudioConnection          patchCord10(dc4, 0, tdm2_1, 9);
AudioConnection          patchCord11(dc5, 0, tdm2_1, 12);
AudioConnection          patchCord12(dc6, 0, tdm2_1, 15);
// GUItool: end automatically generated code




void setup() {
  AudioMemory(100);
  dc1.amplitude(1);
  dc2.amplitude(0.5);
  dc3.amplitude(0.25);
  dc4.amplitude(-0.25);
  dc5.amplitude(-0.50);
  dc6.amplitude(-1);
 
 
  
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}
TDMSammenligningMinus.jpg
 
Can you share what the problem was? Maybe that info could help anyone who later finds this thread by search.

Hey Paul, Yes ofcourse! :)

As it can be seen on the images above i was getting what i did expect from TDM but not TDM2.
It was like something was sending out some "random" data, i think its some kind of register or buffer that was sending data out, i am still not sure what it is.

I did connect a DC signal with the amplitude 0 on some of the TDM2 channel and tried to send something and it worked out.
I had 3 other DC signals which i did connect to the same channels on TDM and TDM2.

I tried to connect i2s2 instead of TDM2 since they use the same pins, i had no problems with that, i could read what i data i sent out. Only problem with i2s was again that there was offset by 2.5 us.


Right now I'm trying to get both TDMs to run synchronously with each other. I think the reason there is a "delay" of 2.5 us, is because the TDMs do not run on the same clock.
So i am trying to get them to run on the same clock.
I have looked a bit at the data sheet and I can see that it should be possible to run them synchronously with each other, I am still working on how, if you have a solution you are very welcome to share it :)

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

// GUItool: begin automatically generated code
AudioSynthWaveformDc     dc7;            //xy=263,488
AudioSynthWaveformDc     dc2;            //xy=321.0000190734863,368.0000648498535
AudioSynthWaveformDc     dc1;            //xy=322.00000762939453,317.00003814697266
AudioSynthWaveformDc     dc3;            //xy=322.0000190734863,420.000066280365
AudioOutputTDM           tdm1;           //xy=642.0000190734863,375
AudioOutputTDM2          tdm2_1;         //xy=647.000020980835,658.0001373291016
AudioConnection          patchCord1(dc7, 0, tdm2_1, 0);
AudioConnection          patchCord2(dc7, 0, tdm2_1, 1);
AudioConnection          patchCord3(dc7, 0, tdm2_1, 3);
AudioConnection          patchCord4(dc7, 0, tdm2_1, 4);
AudioConnection          patchCord5(dc7, 0, tdm2_1, 5);
AudioConnection          patchCord6(dc7, 0, tdm2_1, 7);
AudioConnection          patchCord7(dc7, 0, tdm2_1, 8);
AudioConnection          patchCord8(dc7, 0, tdm2_1, 9);
AudioConnection          patchCord9(dc7, 0, tdm2_1, 10);
AudioConnection          patchCord10(dc7, 0, tdm2_1, 12);
AudioConnection          patchCord11(dc7, 0, tdm2_1, 13);
AudioConnection          patchCord12(dc7, 0, tdm2_1, 14);
AudioConnection          patchCord13(dc7, 0, tdm2_1, 15);
AudioConnection          patchCord14(dc7, 0, tdm1, 0);
AudioConnection          patchCord15(dc7, 0, tdm1, 1);
AudioConnection          patchCord16(dc7, 0, tdm1, 3);
AudioConnection          patchCord17(dc7, 0, tdm1, 4);
AudioConnection          patchCord18(dc7, 0, tdm1, 5);
AudioConnection          patchCord19(dc7, 0, tdm1, 7);
AudioConnection          patchCord20(dc7, 0, tdm1, 8);
AudioConnection          patchCord21(dc7, 0, tdm1, 9);
AudioConnection          patchCord22(dc7, 0, tdm1, 11);
AudioConnection          patchCord23(dc7, 0, tdm1, 12);
AudioConnection          patchCord24(dc7, 0, tdm1, 13);
AudioConnection          patchCord25(dc7, 0, tdm1, 14);
AudioConnection          patchCord26(dc7, 0, tdm1, 15);
AudioConnection          patchCord27(dc2, 0, tdm1, 6);
AudioConnection          patchCord28(dc2, 0, tdm2_1, 6);
AudioConnection          patchCord29(dc1, 0, tdm1, 2);
AudioConnection          patchCord30(dc1, 0, tdm2_1, 2);
AudioConnection          patchCord31(dc3, 0, tdm1, 10);
AudioConnection          patchCord32(dc3, 0, tdm2_1, 11);
// GUItool: end automatically generated code



/*/ GUItool: begin automatically generated code
AudioSynthWaveformDc     dc2;            //xy=355.00001335144043,557.0000953674316
AudioSynthWaveformDc     dc1;            //xy=379.00000762939453,262.0000081062317
AudioOutputI2S2          i2s2_1;         //xy=556,390
AudioOutputI2S           i2s1;           //xy=676.0000228881836,486.0000104904175
AudioConnection          patchCord1(dc2, 0, i2s2_1, 1);
AudioConnection          patchCord2(dc2, 0, i2s1, 1);
AudioConnection          patchCord3(dc1, 0, i2s2_1, 0);
AudioConnection          patchCord4(dc1, 0, i2s1, 0);
/*/ 




void setup() {
  AudioMemory(100);
  dc1.amplitude(1);
  dc2.amplitude(1);
  dc3.amplitude(1);
  dc7.amplitude(0);
   



  /*regn = 1-(1/32768);/*/
  
  
 
 
  
  // put your setup code here, to run once:

}

void loop() {
  
  // put your main code here, to run repeatedly:

}


TDMDervirkerbilled.jpg
 
I stumbled here in my quest for an externally clocked TDM interface (BCLK and LRCLK as inputs). I too had what looked like random data on TDM2 data out (when driven from external LRCLK and BCLK).

Specifically, the output data would "roll" in time with respect to the FSYNC/LRCLK signal. I observed something similar when I changed the number of words on the interface but did not change the DMA and block input sizes to match.

The change that resolved it was connecting something to every input on TDM2. In this case I started with dc values like you did Tengrii.
 
Tengrii-Were you able to get "both TDMs to run synchronously" ? I want to do the same thing in my project.
 
Status
Not open for further replies.
Back
Top