output single frecuency CS4344

enrique

New member
Hi, I'm trying to understand how this i2s protocol works and what can be done with it for later play with DSP filters.
For now I 'm only trying to generate a simple tone with the Teensy 4.1 and convert to analog with the CS4344, then measure frequency with a scope.

I connected the Teensy pins as described in this tread:


I tried this code but I'm only getting noise. What I'm doing wrong?

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code

AudioSynthWaveformSine sine1; //xy=1920.0595201764784,4686.488091605049
AudioOutputI2S i2s1; //xy=2137.9166630336213,4702.91666303362
AudioConnection patchCord1(sine1, 0, i2s1, 0);
AudioConnection patchCord2(sine1, 1, i2s1, 1);
// GUItool: end automatically generated code
void setup(){
sine1.frequency(1000);
sine1.amplitude(1);
}
void loop(){
 
You need to give it some AudioMemory to work with, like so:
C++:
void setup() {
  AudioMemory(8);
  sine1.frequency(1000);
  sine1.amplitude(1);
}

Paul
 
Hi Paul. Still nothing on the output, with AudioMemory(8) added.
What should I expect on teensy's pins when probe with oscilloscope?

currently:
SDIN varing amplitude square wave
SCLK 11.2 MHz
LRCK 11.2 MHz
MCLK 11.2 MHz

I'm using a clone of this board:

Enrique
 
HI Paul, Finally I got the Signal working.

This is the code that works:

#include <Audio.h>

AudioSynthWaveformSine sine1;
AudioOutputI2S i2s1;
AudioControlSGTL5000 audioShield;
AudioConnection patchCord1(sine1, 0, i2s1, 0);
AudioConnection patchCord2(sine1, 0, i2s1, 1);
void setup() {
AudioMemory(10);
audioShield.enable();
audioShield.volume(0.5);
sine1.frequency(1000);
sine1.amplitude(0.5);
}
void loop() {

}
//MCLK pin 23
// SCK (BCLK) Pin 21 (BCLK)
// WS (LRCLK) Pin 20 (LRCLK)
// SDIN Pin 7 (TX)
// GND GND
// VCC (3.3V) 3.3V


It's possible to generate a higher frequency, like 96 khz sampling at 192 khz?

Enrique
 
Back
Top