Hi guys
I am working on a big Audio project that aims at processing audio signals coming from a PDM microphone preamplifier.
The I2S device that I am using is a cheapo UDA1334A that works pretty well with Teensy 4.0 (so far)
I recently started my first steps wiring up a Teensy 4.0 (with the help of this thread: https://forum.pjrc.com/threads/57925-Teensy-4-with-UDA1334A-I2S-decoder-MCLK-not-needed) with success. The example from the previous thread with some minor tweaks works like a charm.
Now, I want to replicate the same result on a Teensy 3.6. The reason being that I tried to compile the following PDM test code for the Teensy 4.0 without success. However, when I do it for Teensy 3.6 it compiles with no errors.
When compiling for Teensy 4.0 I get the following errors:
I am pretty sure that I am missing something or I simply don't clearly understand how the whole library works.
I am having a lot of trouble trying to understand this thread: https://forum.pjrc.com/threads/46719-Finding-I2S-Pins-on-Pinout-Diagram
My apologies but it is NOT clear at all to me what pins are the adequate ones for connecting a Teensy 3.6 to the I2S decoder.
Right now I have the following connections:
Pin 9 (Teensy) to BCLK (UDA1334)
Pin 22 (Teensy) to DIN (UDA1334)
Pin 23 (Teensy) to WSEL (UDA1334)
The only signal I can hear is white noise! (Meaning that I am reading random bytes only, as I understand)
Any help will be very much appreciated.
Stay safe and thanks in advance
dzalf
I am working on a big Audio project that aims at processing audio signals coming from a PDM microphone preamplifier.
The I2S device that I am using is a cheapo UDA1334A that works pretty well with Teensy 4.0 (so far)
I recently started my first steps wiring up a Teensy 4.0 (with the help of this thread: https://forum.pjrc.com/threads/57925-Teensy-4-with-UDA1334A-I2S-decoder-MCLK-not-needed) with success. The example from the previous thread with some minor tweaks works like a charm.
Now, I want to replicate the same result on a Teensy 3.6. The reason being that I tried to compile the following PDM test code for the Teensy 4.0 without success. However, when I do it for Teensy 3.6 it compiles with no errors.
When compiling for Teensy 4.0 I get the following errors:
Code:
C:\Users\XXX\Documents\test_pdm/test_pdm.ino:38: undefined reference to `AudioInputPDM::begin()'
C:\Users\XXX\AppData\Local\Temp\arduino_build_593556\sketch\test_pdm.ino.cpp.o: In function `loop':
C:\Users\XXX\Documents\test_pdm/test_pdm.ino:68: undefined reference to `AudioInputPDM::update()'
C:\Users\XXX\AppData\Local\Temp\arduino_build_593556\sketch\test_pdm.ino.cpp.o: In function `AudioInputPDM::AudioInputPDM()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Audio/input_pdm.h:37: undefined reference to `AudioInputPDM::begin()'
C:\Users\XXX\AppData\Local\Temp\arduino_build_593556\sketch\test_pdm.ino.cpp.o: In function `AudioStream::AudioStream(unsigned char, audio_block_struct**)':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/AudioStream.h:130: undefined reference to `vtable for AudioInputPDM'
collect2.exe: error: ld returned 1 exit status
I am pretty sure that I am missing something or I simply don't clearly understand how the whole library works.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>
#define MUTE_SOUND HIGH
#define UNMUTE_SOUND LOW
// GUItool: begin automatically generated code
AudioInputPDM pdm1; //xy=242,248
AudioOutputI2S i2s1; //xy=614,247
AudioConnection patchCord1(pdm1, 0, i2s1, 0);
AudioConnection patchCord2(pdm1, 0, i2s1, 1);
// GUItool: end automatically generated code
Bounce button0 = Bounce(0, 10);
Bounce button1 = Bounce(1, 10); // 5 ms debounce time
Bounce muteButton = Bounce(2, 10); // 5 ms debounce time
const int mutePin = 13;
bool mutedFlag = false;
void setup() {
Serial.begin(115200);
Serial.println("********* Initialising Audio I2S Moudule: UDA1334 ******************");
Serial.println(" Asisgning pins...");
pdm1.begin();
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(mutePin, OUTPUT);
Serial.println(" Asisgning Audio Memory...");
AudioMemory(10);
Serial.println(" Turning output ON...");
digitalWriteFast(mutePin, UNMUTE_SOUND);
}
void loop() {
pdm1.update();
button0.update();
button1.update();
muteButton.update();
if (button0.fallingEdge()) {
Serial.println(" Button 0 pressed...");
}
if (button1.fallingEdge()) {
Serial.println(" Button 1 pressed...");
}
if (muteButton.fallingEdge()) {
if (mutedFlag == false) {
digitalWriteFast(mutePin, MUTE_SOUND);
Serial.println(" Muted Sound!");
mutedFlag = true;
} else {
digitalWriteFast(mutePin, UNMUTE_SOUND);
Serial.println(" Unmuted Sound!");
mutedFlag = false;
}
}
}
I am having a lot of trouble trying to understand this thread: https://forum.pjrc.com/threads/46719-Finding-I2S-Pins-on-Pinout-Diagram
My apologies but it is NOT clear at all to me what pins are the adequate ones for connecting a Teensy 3.6 to the I2S decoder.
Right now I have the following connections:
Pin 9 (Teensy) to BCLK (UDA1334)
Pin 22 (Teensy) to DIN (UDA1334)
Pin 23 (Teensy) to WSEL (UDA1334)
The only signal I can hear is white noise! (Meaning that I am reading random bytes only, as I understand)
Any help will be very much appreciated.
Stay safe and thanks in advance
dzalf