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

Thread: CS42448 TDM Input

  1. #1

    CS42448 TDM Input

    Hello,

    I recently purchased one of the CS42448 boards from Osh Park, and was able to get output using a sine block connected to the TDM Output block. I would like to connect my audio amplifier's TDM signals directly to the CS42448 board to read the audio data without using the aux ports, and to analyze it. I am in need of any suggestions on how to connect my TDM signals to this board.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,886
    We're talking about this board, right?

    https://www.oshpark.com/shared_projects/2Yj6rFaW

    The 5 TDM signals are connected between the CS42448 and the Teensy by that board, so you shouldn't need to do anything extra on the hardware. Receiving uses pin 13 for all the incoming data, and shares clock pins 9, 11, 23 with transmitting data.

    On the software side, just put this TDM input object into your design.

    https://www.pjrc.com/teensy/gui/?info=AudioInputTDM

    The 6 input signals will appear at ports 0, 2, 4, 6, 8, 10 of that TDM object. Leave the other 10 unused in the design.

    In your code, make sure you have a large enough number for AudioMemory(). The TDM object alone will need 16 blocks, so use a number like 40 or more so you're giving the audio library enough memory to do all the work.

  3. #3
    Yes, that is correct! Thanks for the quick reply, Paul. I was able to successfully get TDM output using an aux cable as input, and headphones as output. But, when I connect my USBStreamer device's TDM connections to the Teensy's pins, I hear loud static which changes in frequency and volume depending on the song I play, as if it is attempting to play audio. Is it possible I would need to change some of the register settings based on the input device I have?

  4. #4
    Hi Paul, not sure if you saw my previous message?
    Thanks!

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    17,886
    Do you want me to help figure out what's wrong?

    The very first step is to post a complete (and hopefully small) program which I can run on my CS42448 here, to reproduce the problem.

  6. #6
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>

    // GUItool: begin automatically generated code
    AudioControlCS42448 CS42448_Chip; //xy=334.99999237060547,42.000009536743164
    AudioInputTDM TDMInput; //xy=300.00000381469727,344
    AudioOutputTDM TDMOutput; //xy=1027.0834007263184,335.0556411743164

    AudioAnalyzePeak Peak_Ch1L; //xy=679.0000076293945,60.0000057220459
    AudioAnalyzePeak Peak_Ch1R; //xy=679,93.00000190734863
    AudioAnalyzePeak Peak_Ch2L; //xy=679.0000076293945,127.00000190734863
    AudioAnalyzePeak Peak_Ch2R; //xy=680.0000076293945,160.00000190734863
    AudioAnalyzePeak Peak_Ch3L; //xy=679.0000076293945,194.00000286102295
    AudioAnalyzePeak Peak_Ch3R; //xy=677.0000076293945,228.00000286102295
    AudioAnalyzePeak Peak_Ch4L; //xy=678.0000076293945,264.00000381469727
    AudioAnalyzePeak Peak_Ch4R; //xy=678.0000076293945,297.00000381469727
    AudioAnalyzePeak Peak_Ch5L; //xy=679.0000076293945,332.0000047683716
    AudioAnalyzePeak Peak_Ch5R; //xy=679.0000076293945,366.0000057220459
    AudioAnalyzePeak Peak_Ch6R; //xy=679.0000076293945,434.0000057220459
    AudioAnalyzePeak Peak_Ch8R; //xy=679.0000076293945,580.0000095367432
    AudioAnalyzePeak Peak_Ch6L; //xy=680.0000076293945,400.0000057220459
    AudioAnalyzePeak Peak_Ch7R; //xy=680.0000076293945,507.0000078678131
    AudioAnalyzePeak Peak_Ch8L; //xy=680.0000076293945,544.0000085830688
    AudioAnalyzePeak Peak_Ch7L; //xy=681.0000076293945,471.00000762939453

    AudioConnection patchCord1(TDMInput, 0, Peak_Ch1L, 0);
    AudioConnection patchCord2(TDMInput, 0, TDMOutput, 0);
    AudioConnection patchCord3(TDMInput, 1, Peak_Ch1R, 0);
    AudioConnection patchCord4(TDMInput, 1, TDMOutput, 1);
    AudioConnection patchCord5(TDMInput, 2, Peak_Ch2L, 0);
    AudioConnection patchCord6(TDMInput, 2, TDMOutput, 2);
    AudioConnection patchCord7(TDMInput, 3, Peak_Ch2R, 0);
    AudioConnection patchCord8(TDMInput, 3, TDMOutput, 3);
    AudioConnection patchCord9(TDMInput, 4, Peak_Ch3L, 0);
    AudioConnection patchCord10(TDMInput, 4, TDMOutput, 4);
    AudioConnection patchCord11(TDMInput, 5, Peak_Ch3R, 0);
    AudioConnection patchCord12(TDMInput, 5, TDMOutput, 5);
    AudioConnection patchCord13(TDMInput, 6, Peak_Ch4L, 0);
    AudioConnection patchCord14(TDMInput, 6, TDMOutput, 6);
    AudioConnection patchCord15(TDMInput, 7, Peak_Ch4R, 0);
    AudioConnection patchCord16(TDMInput, 7, TDMOutput, 7);
    AudioConnection patchCord17(TDMInput, 8, Peak_Ch5L, 0);
    AudioConnection patchCord18(TDMInput, 8, TDMOutput, 8);
    AudioConnection patchCord19(TDMInput, 9, Peak_Ch5R, 0);
    AudioConnection patchCord20(TDMInput, 9, TDMOutput, 9);
    AudioConnection patchCord21(TDMInput, 10, Peak_Ch6L, 0);
    AudioConnection patchCord22(TDMInput, 10, TDMOutput, 10);
    AudioConnection patchCord23(TDMInput, 11, Peak_Ch6R, 0);
    AudioConnection patchCord24(TDMInput, 11, TDMOutput, 11);
    AudioConnection patchCord25(TDMInput, 12, Peak_Ch7L, 0);
    AudioConnection patchCord26(TDMInput, 12, TDMOutput, 12);
    AudioConnection patchCord27(TDMInput, 13, Peak_Ch7R, 0);
    AudioConnection patchCord28(TDMInput, 13, TDMOutput, 13);
    AudioConnection patchCord29(TDMInput, 14, Peak_Ch8L, 0);
    AudioConnection patchCord30(TDMInput, 14, TDMOutput, 14);
    AudioConnection patchCord31(TDMInput, 15, Peak_Ch8R, 0);
    AudioConnection patchCord32(TDMInput, 15, TDMOutput, 15);


    //select peak val variables for all 8 channels
    int CH1_LPeak, CH1_RPeak, CH2_LPeak, CH2_RPeak, CH3_LPeak, CH3_RPeak,
    CH4_LPeak, CH4_RPeak, CH5_LPeak, CH5_RPeak, CH6_LPeak, CH6_RPeak,
    CH7_LPeak, CH7_RPeak, CH8_LPeak, CH8_RPeak;

    // GUItool: end automatically generated code

    void setup()
    {
    Serial.begin(9600);
    AudioMemory(150);
    CS42448_Chip.enable();
    CS42448_Chip.volume(0.5);
    }

    void loop() {
    }

Tags for this Thread

Posting Permissions

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