Audio I2S Input not working

Status
Not open for further replies.

afarhan

Member
I have the lastest beta 1.34 of the teensyduino installed on Arduino 1.8.3. All the examples related to the audio output work (Guitar, SimpleDrum. etc). None of the audio input programs like the PassThrough Stereo work.
I have probed the board. All the three clocks seem to be fine. The pin 22 is permanently low, The pin 13 is floating (probably, in tri-state). Any idea if I should debug anything on the I2C ?
- farhan (VU2ESE)
 
Some tests

I tried forcing the mic to open up with this code (no, joy, the audio shield continues to be silent, though it plays back very well). The pin 22 shows a constant 87.71 KHz square wave when I ran this code, pin 13 continued to float. (I am using Arduino 1.8.3, the latest teensyduino from pjrc.com on Ubuntu 14.04)

/ * Line-In pins and send it to the Line-Out pins and headphone jack.
*
* This example code is in the public domain.
*/

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

// GUItool: begin automatically generated code
AudioInputI2S i2s1; //xy=200,69
AudioOutputI2S i2s2; //xy=365,94
AudioConnection patchCord1(i2s1, 0, i2s2, 0);
AudioConnection patchCord2(i2s1, 1, i2s2, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=302,184
// GUItool: end automatically generated code


const int myInput = AUDIO_INPUT_LINEIN;
//const int myInput = AUDIO_INPUT_MIC;


void setup() {
Serial.begin(9600);
// 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
sgtl5000_1.enable();
sgtl5000_1.inputSelect(myInput);
sgtl5000_1.volume(0.5);
sgtl5000_1.write(0x002A, 0x0173); // mic preamp gain = +40dB
sgtl5000_1.write(0x0020, 0x0FF); // input gain +12dB (is this enough?)
sgtl5000_1.write(0x0024, 0x022);
}

elapsedMillis volmsec=0;

void loop() {

delay(2000);
Serial.printf("ID:%4x\n", sgtl5000_1.read(0x0000));
Serial.printf("DIG_POWER:%4x\n", sgtl5000_1.read(0x0002));
Serial.printf("CLK_CTRL:%4x\n", sgtl5000_1.read(0x0004));
Serial.printf("I2S_CTRL:%4x\n", sgtl5000_1.read(0x0006));
Serial.printf("SSS_CTRL:%4x\n", sgtl5000_1.read(0x000A));
Serial.printf("ADCDAC_CTRL:%4x\n", sgtl5000_1.read(0x000E));
Serial.printf("DAC_VOL:%4x\n", sgtl5000_1.read(0x0010));

Serial.printf("PAD_STRENGTH:%4x\n", sgtl5000_1.read(0x0014));
Serial.printf("ANA_ADC_CTRL:%4x\n", sgtl5000_1.read(0x0020));
Serial.printf("ANA_HP_CTRL:%4x\n", sgtl5000_1.read(0x0022));
Serial.printf("ANA_CTRL:%4x\n", sgtl5000_1.read(0x0024));
Serial.printf("LINEREG_CTRL:%4x\n", sgtl5000_1.read(0x0026));
Serial.printf("MIC_CTRL:%4x\n", sgtl5000_1.read(0x002A));
Serial.printf("LINE_OUT_CTRL:%4x\n", sgtl5000_1.read(0x002c));

Serial.printf("LINE_OUT_VOL:%4x\n", sgtl5000_1.read(0x002e));
Serial.printf("ANA_POWER:%4x\n", sgtl5000_1.read(0x0030));
Serial.printf("\n");

}



>>>>>>>>>>>>>>>>>>>>>>>>


Here is the dump of the I2C status as i could analyze it :
I took a dump of the status of the STGL5000 registers. Here is the dump:

ID:a011 (ID of the chip)
DIG_POWER: 73 (ADC, DAC, DAP, I2S_IN, I2S_OUT are all powered up)
CLK_CTRL: 4 (MCLK: 256x fS, 44.1 KHz, SYS_FS specifies the rate)
I2S_CTRL: 130 (32x FS, I2S, left justfied mode)
SSS_CTRL: 10 (I2S_IN > DAC, ADC > I2SOUT)
ADCDAC_CTRL: 0 (All, normal, unmuted)
DAC_VOL:3c3c (Left 0 db, right :0db)
PAD_STRENGTH:555f (???)
ANA_ADC_CTRL: 55 (Left, Right volume set to 5)
ANA_HP_CTRL:4040 (10, 10) db
ANA_CTRL: 26 (LINE_OUT: unmuted, HP_IN : DAC, HP_ZPC:yes, ADC_IN: LINE_IN, ADC_ZPC: yes, vol : unmuted)
LINEREG_CTRL: 6c (normal,both over 3v)
MIC_CTRL: 172 (+20 db gain, 3v bias, 2k bias resistor)
LINE_OUT_CTRL: f22 (highest)
LINE_OUT_VOL:1d1d (high)
ANA_POWER: 40ff (normal)
 
pin 13 is I2S data-in it should not float. it should follow the bit pattern of the data coming into the Teensy.
If, as you say, nothing comes in, pin13 should be constant.
maybe stop reading the sgtl5000 registers?
 
I wrote the register dump after seeing the waveforms. Removing them doesn't change anything

pin 13 is I2S data-in it should not float. it should follow the bit pattern of the data coming into the Teensy.
If, as you say, nothing comes in, pin13 should be constant.
maybe stop reading the sgtl5000 registers?
 
So do you have the teensy mic installed on the audio shield? Have you tried the audio tutorial example Part_2_04_Microphone_Check ? or is your problem just with I2S line in?
 
So do you have the teensy mic installed on the audio shield? Have you tried the audio tutorial example Part_2_04_Microphone_Check ? or is your problem just with I2S line in?

I did try the example... with the mic. No output at all. Is it possible that the shield is busted?
 
If your mic is an electret attached to the mic/gnd pair of pins, then you need the following line un-commented
//const int myInput = AUDIO_INPUT_MIC;
(And the line above it commented out.)

Can you reply with a picture of your setup?
 
Status
Not open for further replies.
Back
Top