On Board LED?

Status
Not open for further replies.

jkoffman

Well-known member
Hi all,

I'm sure this question has an easy answer, but I'm missing it.

In the audio library tutorials, the on board pin 13 LED is used as an example of something to be done while playing a file. According to the schematic of the audio board, pin 13 on the Teensy is connected to the RX line of the SGTL5000.

How does this work?

Thanks!

Josh
 
From
https://www.pjrc.com/store/teensy3_audio.html

The audio chip, part number SGTL5000, connects to Teensy using 7 signals. The I2C pins SDA and SCL are used to control the chip and adjust parameters. Audio data uses I2S signals, TX (to headphones and/or line out) and RX (from line in or mic), and 3 clocks, LRCLK (44.1 kHz), BCLK (1.41 MHz) and MCLK (11.29 MHz). All 3 clocks are created by Teensy3. The SGTL5000 operates in "slave mode", where all its clock pins are inputs.

So that RX pin is used to gather audio from the chip. If the demo hasn't configured the pin on the audio side to do anything then it can happily drive the pin to have the LED doing things while playing audio out the TX pin. A separate LED would be better but would have complicated the tutorial with extra parts.
 
So that RX pin is used to gather audio from the chip. If the demo hasn't configured the pin on the audio side to do anything then it can happily drive the pin to have the LED doing things while playing audio out the TX pin. A separate LED would be better but would have complicated the tutorial with extra parts.

Ah, that makes sense. I didn't realize it could be otherwise used without messing up the operations of the chip.

Thanks for the reply!

Josh
 
i'm passing through mic signal to USBOutput, and LED 13 is constantly flickering

my teensy suppose to constantly be connected, but that LED flicker is annoying

i thought there would be function like sgtl5000_1.disable(), to make it stop, but there is no such thing

one thing that helps is sgtl5000_1.micGain(0), at least LED now just lit up without flickering

to switch between 0 and 30 mic gain, i have a simple push-button

also AudioInterrupts() and AudioNoInterrupts() don't help too

is there any way to turn audio library off by pressing push-button, and then turn it on by the same button?

or maybe there is a way to "unplug" TX wire with a push-button?

my goal is to turn it off when i go to sleep, but i don't wanna plug/unplug usb everyday, push-button would be enough

my current code
Code:
#include <Audio.h>
#include <Bounce.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputI2S            i2s1;           //xy=494,329
AudioOutputUSB           usb1;           //xy=845,327
AudioConnection          patchCord1(i2s1, 0, usb1, 0);
AudioConnection          patchCord2(i2s1, 1, usb1, 1);
AudioControlSGTL5000     sgtl5000_1;     //xy=739,446
// GUItool: end automatically generated code

int buttonPin = 8;
Bounce button8 = Bounce(buttonPin, 15);
int state = 1;

void setup() {                
  AudioMemory(12);
  sgtl5000_1.enable();
  sgtl5000_1.adcHighPassFilterDisable();
  sgtl5000_1.volume(0);
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  sgtl5000_1.micGain(30);
  pinMode(buttonPin, INPUT_PULLUP);
  delay(1000);
}

void loop() {
  button8.update();
  if (button8.fallingEdge()) {
    if (state == 0) {
      state = 1;
      sgtl5000_1.micGain(30);
      AudioInterrupts();
    } else {
      state = 0;
      sgtl5000_1.micGain(0);
      AudioNoInterrupts();
    }
  }
}

thx
 
The LED is on the same pin which receives I2S data, so there's no way to have one without the other. Well, not unless you desolder the LED.
 
Status
Not open for further replies.
Back
Top