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

Thread: TI PCM3168A Audio Control Object

  1. #1
    Junior Member
    Join Date
    Apr 2019
    Location
    Portugal
    Posts
    2

    TI PCM3168A Audio Control Object

    Hi guys,
    First time posting so start by thanking Paul for his amazing work.

    I'm developing a multitrack DSP solution for academic purposes.
    I'm using a Teensy 3.6, and for the project I need at least 8 Out's and TDM so and I'v opted to use the Texas Inst. PCM3168A
    http://www.ti.com/product/PCM3168A


    I'm coding the audio Audio Control Object for the PCM but i'm finding many roadblocks, mainly because I can't wrap my head around what's happening between the other control files and the audio lib ... So I come to you, ho mighty community, in hope you can shed some light as and help get out of noob lane.
    I've set up a repository with what i'v developed this far.
    https://github.com/lfpneto/Control_Pcm3168a

    I2S control is working (yey!), but i can't get any sound into the thing(PCM3168a)!!
    I'm using a white noise object, Teensy 3.6 TXD0 (pin 22) into PCM DIN 1 (pin 37).

    The code:
    Code:
    /* BASED ON TONE SWEEP EXAMPLE
    */
    
    #include <Audio.h>
    //#include "Wire.h"
    #include <i2c_t3.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    #include "Control_Pcm3168a.h"
    
    // WHITENOISE
    // AudioSynthToneSweep  myEffect;
    AudioSynthNoiseWhite    myEffect;
    AudioOutputI2S          audioOutput;        // audio shield: headphones & line-out
    
    // The WHITENOISE goes to left and right channels
    AudioConnection c1(myEffect, 0, audioOutput, 0);
    AudioConnection c2(myEffect, 0, audioOutput, 1);
    
    AudioControlPCM3168A  PCM3168A(true);
    
    // when there is a call to function inputSelect(), 
    // expected to return do serial port AUDIO_INPUT_LINEIN address
    const int myInput = AUDIO_INPUT_LINEIN;
    //const int myInput = AUDIO_INPUT_MIC;
    
    
    void setup() {
    
      Serial.begin(9600);
      while (!Serial) ;
      delay(3000);
    
    
      // ******
      // ******
      PCM3168A.TesteSerial();
      //PCM3168A.setSlaveAddress();
      //PCM3168A.readReg(0x41);
      //PCM3168A.readReg(0x51);
      //PCM3168A.disable();
      //PCM3168A.MasterReset();
      //PCM3168A.Resynch();
    
    
      // ******
      // ****** BLINK
      pinMode(13, OUTPUT); // initialize the digital pin as an output.
      digitalWrite(13, HIGH);   // set the LED on
    
      // Audio connections require memory to work.  For more
      // detailed information, see the MemoryAndCpuUsage example
      AudioMemory(12);
    
    
      // Enable the audio shield, select input, and enable output
      PCM3168A.enable();
      delay(100);
      PCM3168A.begin(4);
      //Mode 1 - DAC I2S Slave - ADC I2S Slave
      //Mode 2 - DAC I2S Master - ADC I2S Slave
      //Mode 3 - DAC I2S Slave - ADC I2S Master
      //Mode 4 - DAC I2S Master - ADC I2S Master
    
    
      PCM3168A.inputSelect(myInput);
      PCM3168A.volume(1);
      //PCM3168A.Resynch();
      delay(100);
      PCM3168A.readAllReg();
    
    
    myEffect.amplitude(1);
    
    digitalWrite(13, LOW);   // set the LED on
    }
    void loop() {
    
      // ******
      // ****** BLINK
      digitalWrite(13, HIGH);   // set the LED on
      delay(1000);                  // wait for a second
      digitalWrite(13, LOW);    // set the LED off
      delay(1000);                  // wait for a second
    }

  2. #2
    Junior Member
    Join Date
    Apr 2019
    Location
    Portugal
    Posts
    2
    I've updated the code to include a modified version of the WireKinetis files in the Wire library.
    Only compatible with a modified Audio library...

Posting Permissions

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