
Originally Posted by
MarkT
Are you talking to the display (ie using SPI bus) when the high pitched noise is audible? Or could it be
the PWM for the LED backlight?
No, I am not talking to the display. In fact I have tested this simple sketch that is doing nothing with the display really, and the sound is present.
Code:
#define VOL_HEADPHONES_PIN A3
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SdFat.h>
#include <SerialFlash.h>
#include <Bounce.h>
#include <ILI9341_t3.h>
AudioPlaySerialflashRaw playSfRaw1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(playSfRaw1, 0, i2s1, 0);
AudioConnection patchCord6(playSfRaw1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;
const int FlashChipSelect = 6;
// Audio shield rev D (Teensy 4.x)
const int FLASH_SCK_PIN = 13;
const int FLASH_MOSI_PIN = 11;
const int TFT_CS_PIN = 10;
const int TFT_RST_PIN = 255; // 255 = unused, connect to 3.3V
const int TFT_DC_PIN = 9;
const int TFT_MOSI_PIN = 26; //11;
const int TFT_SCLK_PIN = 13;
const int TFT_MISO_PIN = 1; //12;
float volHeadphone = 0.5;
Bounce btnA = Bounce(4, 20);
Bounce btnB = Bounce(5, 20);
Bounce btnC = Bounce(24, 20);
ILI9341_t3 tft = ILI9341_t3(TFT_CS_PIN, TFT_DC_PIN, TFT_RST_PIN, TFT_MOSI_PIN, TFT_SCLK_PIN, TFT_MISO_PIN);
void setup() {
AudioMemory(60);
sgtl5000_1.enable();
sgtl5000_1.volume(0.5);
SPI.setSCK(FLASH_SCK_PIN);
SPI.setMOSI(FLASH_MOSI_PIN);
Serial.begin(9600);
// wait up to 10 seconds for Arduino Serial Monitor
unsigned long startMillis = millis();
while (!Serial && (millis() - startMillis < 10000)) ;
delay(100);
if (!SerialFlash.begin(FlashChipSelect)) {
Serial.println("Unable to access SPI Flash chip");
}
delay(1000);
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(24, INPUT_PULLUP);
}
void loop() {
btnA.update();
btnB.update();
btnCl.update();
if (btnA.fallingEdge()) {
playSfRaw1.play("A1L.RAW");
}
if (btnB.fallingEdge()) {
playSfRaw1.play("A2L.RAW");
}
if (btnC.fallingEdge()) {
playSfRaw1.play("A3L.RAW");
}
}
I was using pins 11 and 12, but I changed them to check if that was the problem, as they are used by the Audio Board too.
As for the backlight I tried removing the connection for this pin without success, but I don't know if that is a good way of checking it.

Originally Posted by
MarkT
The pops will be a DC offset on the right hand channel I think. Are you sure its getting data - you've not
called AudioMemory so no blocks are being pushed to the DAC I think...
I removed the AudioMemory allocation in the sketch I posted as I was reducing my code iteratively to see if I could catch any error in it.
What sounds weird to me is that I am using the Teensy and the Audio Board directly, no more hardware. So how could I solve it in case this is the issue?
Thank you for your help.