Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Different output between TDM1 and TDM2

  1. #1
    Junior Member
    Join Date
    Aug 2020
    Posts
    13

    Different output between TDM1 and TDM2

    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:
    
    }
    Click image for larger version. 

Name:	TDMSammenligning.jpg 
Views:	12 
Size:	98.9 KB 
ID:	21796

  2. #2
    Junior Member
    Join Date
    Aug 2020
    Posts
    13
    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:
    
    }
    Click image for larger version. 

Name:	TDMSammenligningMinus.jpg 
Views:	7 
Size:	96.2 KB 
ID:	21797

  3. #3
    Junior Member
    Join Date
    Aug 2020
    Posts
    13
    I managed to fix my problem

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,767
    Can you share what the problem was? Maybe that info could help anyone who later finds this thread by search.

  5. #5
    Junior Member
    Join Date
    Aug 2020
    Posts
    13
    Quote Originally Posted by PaulStoffregen View Post
    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:
    
    }

    Click image for larger version. 

Name:	TDMDervirkerbilled.jpg 
Views:	6 
Size:	92.9 KB 
ID:	21836

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •