I haven't spent that much time with this yet, but I am considering using the audio library to create a test sine wave to check an external ADC.
From what I understand, I can control amplitude, frequency, and phase.
I need the tone centered about Vref/2 of the ADC. I suppose I can simply use an op amp for that. The ADC I am trying to check my Teensy driver code on is the AD7667. Is the code as easy as the following? Or is there more to it than this? I have never used these tools. I will use a Teensy4 and an audio shield as the stimulus for my ADC running data collection on a Teensy4.1.
As a completely new person to this, does the signal come out at the line level? I need to drive a 10k load (which is buffered and drives the ADC with an amplifier).
On the second Teensy with the ADC I want to capture about 16K samples and do a floating point FFT. I haven't even thought about how to start that. But first, I simply need to generate a clean sine wave. How many bits is the audio generator? The sampling rate is currently 1 MHz, although I can adjust it.
Be gentle, but kindly point me in the right direction Much appreciated.
From what I understand, I can control amplitude, frequency, and phase.
I need the tone centered about Vref/2 of the ADC. I suppose I can simply use an op amp for that. The ADC I am trying to check my Teensy driver code on is the AD7667. Is the code as easy as the following? Or is there more to it than this? I have never used these tools. I will use a Teensy4 and an audio shield as the stimulus for my ADC running data collection on a Teensy4.1.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveformSine sine1; //xy=185.1666717529297,260.1666717529297
AudioMixer4 mixer1; //xy=414.1666717529297,272.1666717529297
AudioOutputI2S i2s1; //xy=711.1666717529297,276.1666717529297
AudioConnection patchCord1(sine1, 0, mixer1, 0);
AudioConnection patchCord2(mixer1, 0, i2s1, 0);
AudioConnection patchCord3(mixer1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=316.1666717529297,424.1666717529297
// GUItool: end automatically generated code
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
// Audio connections require memory to work. For more
// detailed information, see the MemoryAndCpuUsage example
AudioMemory(10);
// Comment these out if not using the audio adaptor board.
// This may wait forever if the SDA & SCL pins lack
// pullup resistors
sgtl5000_1.enable();
sgtl5000_1.volume(0.8); // caution: very loud - use oscilloscope only!
sine1.amplitude(0.1);
sine1.frequency(1e4);
sine1.phase(0.0);
}
void loop() {
// put your main code here, to run repeatedly:
}
On the second Teensy with the ADC I want to capture about 16K samples and do a floating point FFT. I haven't even thought about how to start that. But first, I simply need to generate a clean sine wave. How many bits is the audio generator? The sampling rate is currently 1 MHz, although I can adjust it.
Be gentle, but kindly point me in the right direction Much appreciated.