I have run tests with the example: PT8211Sine code
It produces almost no distortion which is good. Maybe my chip is Ok after all
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=110,75
AudioSynthWaveform waveform2; //xy=110,75
AudioOutputPT8211 pt8211_1; //xy=303,78
AudioMixer4 mix1;
AudioMixer4 mix2;
AudioConnection c1(waveform1, 0, mix1, 0);
AudioConnection c2(waveform2, 0, mix2, 0);
AudioConnection c3(waveform1, 0, pt8211_1, 0); // right channel
AudioConnection c4(waveform2, 0, pt8211_1, 1); // left channel
// GUItool: end automatically generated code
void setup() {
AudioMemory(15);
mix1.gain(0,0.9);
mix2.gain(0,0.9);
waveform1.begin(WAVEFORM_SINE);
waveform1.frequency(44);
waveform1.amplitude(0.0001);
waveform2.begin(WAVEFORM_SINE);
waveform2.frequency(440);
waveform2.amplitude(0.2);
}
void loop() {
}
I'm seeing left channel = c4
In this case it works OK (see Sine 1)
(The right channel also works as expected)
But if I change connection c3 to:
AudioConnection c3(mix1, 0, pt8211_1, 0); // right channel
I get a distortion on the left channel = Sine 2
(and the right channel is silent)
If I change to left also (both channels through mixers)
AudioConnection c4(mix2, 0, pt8211_1,1); // left channel
Everything works OK again.
If I do the same in my earlier Flash_pt_test example the code hangs instead and the Left channel is silent.
Something must be wrong in the code for the PT8211 output running on Teensy 4.0
/Tomas