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

Thread: SGTL5000 LineOut Impedance

  1. #1

    SGTL5000 LineOut Impedance

    I generate a sawtooth waveform and output it via the SGTL5000 Audio Board (see code below). The LineOut output seems to have a quite large impedance. When I connect the output pin with ground via a 10k resistor the signal nearly vanishes. But the SGTL datasheet says the output impedance of the lineout pin is 320 Ohm. Something is wrong here. Has someone experienced this behaviour or do I make an error in my program? Has someone a similar code that works?
    Code:
    #include <Audio.h>
    #include <Wire.h>
    
    
    
    // GUItool: begin automatically generated code
    AudioInputI2S            i2s2;           //xy=137,257
    AudioRecordQueue         recordQueue1;    //xy=332,296
    AudioRecordQueue         recordQueue2;         //xy=335,229
    AudioPlayQueue           playQueue1;         //xy=503,230
    AudioPlayQueue           playQueue2;      //xy=504,298
    AudioOutputI2S           i2s1;           //xy=680,263
    AudioConnection          patchCord1(i2s2, 0, recordQueue2, 0);
    AudioConnection          patchCord2(i2s2, 1, recordQueue1, 0);
    AudioConnection          patchCord3(playQueue1, 0, i2s1, 0);
    AudioConnection          patchCord4(playQueue2, 0, i2s1, 1);
    AudioControlSGTL5000     sgtl5000_1;     //xy=322,165
    // GUItool: end automatically generated code
    
    
    
    void setup() {
      Serial.begin(9600);  
      delay(1000) ;
      
      Serial.println("Hello World"); 
      sgtl5000_1.enable();
      sgtl5000_1.volume(1.0);
      sgtl5000_1.lineOutLevel(2);
     
      AudioMemory(64); 
     
      recordQueue1.begin();
      recordQueue2.begin();
      }
    
    
    int16_t *input_L ;  
    int16_t *output_L ;  
    int16_t *input_R ;  
    int16_t *output_R ;  
    
    
    int sawtooth=0 ;
    
    void loop() {
       while(1){
       if( (recordQueue1.available() > 12 ) & (recordQueue2.available() > 12 ) ) {
           for (int i = 0; i < 8; i++) {
             input_L = recordQueue1.readBuffer();
             output_L = playQueue1.getBuffer();
             input_R = recordQueue2.readBuffer();
             output_R = playQueue2.getBuffer();
             
             recordQueue1.freeBuffer();
             recordQueue2.freeBuffer();
             for(int k=0 ; k<128 ; k++){ 
                // output_L[k]=input_L[k] ; 
                output_R[k]=input_R[k] ;
                output_L[k]=sawtooth ; 
                // output_R[k]=sawtooth ;
                sawtooth++ ; if (sawtooth>32000){ sawtooth=0 ; }
                }
             playQueue1.playBuffer();
             playQueue2.playBuffer();
             }
          } 
       }
    }

  2. #2
    Senior Member
    Join Date
    May 2016
    Posts
    229
    I would think that this is a hardware problem, not a software problem, unless your sawtooth has a very, very low frequency.

    I don't follow what the sawtooth is actually doing in loop() is it just a loop counter? What do you expect its frequency to be?

    Is the output behavior the same at audio frequencies , say 1kHz?

    Is the output amplitude with no load resistor what you expect it to be?

    The Audio Board output is coupled through a 2.2 ufd cap (1 ufd on early boards) and should have a sub 1Hz cut-off frequency. The first thing I would check is whether you really do have a 10k resistor and not something much lower.

    Do both channels exhibit the same behavior?

    (BTW - you don't need the while(1){} loop, because loop() will loop forever anyway)

  3. #3
    @DerekR: Thanks for your hint. My sawtooth has 1.4Hz and a 2u2+10k highpass has 7Hz cutoff frequency. So my frequency is too low. If I increase the sawtooth frequency to 100Hz everything is ok!

Posting Permissions

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