Hello Forum,
In the first step of using the AUDIO SHIELD circuit (rev D for TEENSY 4.0) I connected an analog microphone at the input and a pair of headphones at the output to listen the audio input signal. Using the GUI I also connected PEAK and RMS objects. I measured and displayed in the console the PEAK and RMS levels for every 500 ms. Everything worked fine. Since I understood that TEENSY 4.0 is being used in I2S MASTER mode, I checked the I2S signals between the microcontroller and SGTL5000 with an oscilloscope (I found 64 BCLK pulses for 1 period of the LRCLK signal, 3V3). I wanted to connect an I2S microphone (type MSM261S4030H0 https://www.filipeflop.com/img/files/download/Datasheet-Microfone-Sipeed-MSM261S4030H0.pdf) instead of the analog one and I interrupted the connection SGTL5000 pin 25 - Audio Shield pin 8 (immediate effect: the audio signal could not be heard by the headphones). Then I connected the I2S signals (BCLK and LRCLK generated by TEENSY MASTER) to the I2S microphone corresponding pins (SCK,WS) and the microphone SD signal to TEENSY pin 8 (instead of the CODEC signal). I expected to hear the audio signal picked up by the I2S microphone in my headphones, but nothing was heard even though I saw pulses generated on RX/Dout pin 8 line by I2S microphone. Do you know the procedure for connecting an I2S microphone to AUDIO SHIELD? Do certain conditions have to be met?
Thank you for your support
In the first step of using the AUDIO SHIELD circuit (rev D for TEENSY 4.0) I connected an analog microphone at the input and a pair of headphones at the output to listen the audio input signal. Using the GUI I also connected PEAK and RMS objects. I measured and displayed in the console the PEAK and RMS levels for every 500 ms. Everything worked fine. Since I understood that TEENSY 4.0 is being used in I2S MASTER mode, I checked the I2S signals between the microcontroller and SGTL5000 with an oscilloscope (I found 64 BCLK pulses for 1 period of the LRCLK signal, 3V3). I wanted to connect an I2S microphone (type MSM261S4030H0 https://www.filipeflop.com/img/files/download/Datasheet-Microfone-Sipeed-MSM261S4030H0.pdf) instead of the analog one and I interrupted the connection SGTL5000 pin 25 - Audio Shield pin 8 (immediate effect: the audio signal could not be heard by the headphones). Then I connected the I2S signals (BCLK and LRCLK generated by TEENSY MASTER) to the I2S microphone corresponding pins (SCK,WS) and the microphone SD signal to TEENSY pin 8 (instead of the CODEC signal). I expected to hear the audio signal picked up by the I2S microphone in my headphones, but nothing was heard even though I saw pulses generated on RX/Dout pin 8 line by I2S microphone. Do you know the procedure for connecting an I2S microphone to AUDIO SHIELD? Do certain conditions have to be met?
Thank you for your support
/* Adaptation of Stereo peak meter example, including RMS.
assumes Audio adapter but just uses terminal so no more parts required.
This example code is in the public domain
*/
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
//const int myInput = AUDIO_INPUT_LINEIN;
const int myInput = AUDIO_INPUT_MIC;
AudioInputI2S audioInput; // audio shield: mic or line-in
AudioAnalyzePeak peak_L;
AudioAnalyzePeak peak_R;
AudioAnalyzeRMS rms_L;
AudioAnalyzeRMS rms_R;
AudioOutputI2S audioOutput; // audio shield: headphones & line-out
AudioConnection c1(audioInput, 0, peak_L, 0);
AudioConnection c2(audioInput, 1, peak_R, 0);
AudioConnection c3(audioInput, 0, rms_L, 0);
AudioConnection c4(audioInput, 1, rms_R, 0);
AudioConnection c5(audioInput, 0, audioOutput, 0);
AudioConnection c6(audioInput, 1, audioOutput, 1);
AudioControlSGTL5000 audioShield;
void setup() {
AudioMemory(6);
audioShield.enable();
audioShield.inputSelect(myInput);
audioShield.volume(0.5);
Serial.begin(9600);
}
elapsedMillis fps;
uint8_t cnt=0;
void loop() {
if(fps > 500) {
if (peak_L.available() && peak_R.available() && rms_L.available() && rms_R.available()) {
fps=0;
uint8_t leftPeak = peak_L.read() * 100.0;
uint8_t rightPeak = peak_R.read() * 100.0;
uint8_t leftRMS = rms_L.read() * 100.0;
uint8_t rightRMS = rms_R.read() * 100.0;
Serial.print("LEFT PEAK = ");Serial.println(leftPeak);
Serial.print("RIGHT PEAK = ");Serial.println(rightPeak);
Serial.print("LEFT RMS = ");Serial.println(leftRMS);
Serial.print("RIGHT RMS = ");Serial.println(rightRMS);
Serial.println();
}
}
}
Attachments
Last edited: