teensy 4.0 - 16 channels TDM output

Status
Not open for further replies.

memo-1402

New member
Hello,
I would like ask some help for my audio project. I'm traying to do a 16 channels TDM input board with 2 codec from analog device AD1934. So I need to out from my teensy 4.0 a frame with 16 channels of 32 bits of 48kHz of sample. I wrote some code but there are several issue that I don't know the source.

It works fine when I play only one WAV file but when I try 2 or more, I can hear swapped peak song every second while the WAV is playing and only odd channels of tdm is playing. Did I miss something? It is because of the codec needs 32 bits for each channel and no 16? Please can you help me for this, it's very important? Sory for my English and thank you for your advices :) Don't have digital scope.

Code:
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>
#include "ad1934.h" *// include the new SPI library:

AudioPlaySdWav * * * * * playSdWav1; * * 
AudioPlaySdWav * * * * * playSdWav2; * * 
AudioPlaySdWav * * * * * playSdWav3; * * 
AudioPlaySdWav * * * * * playSdWav4; * * 
AudioPlaySdWav * * * * * playSdWav5; * * 
AudioPlaySdWav * * * * * playSdWav6; * * 
AudioPlaySdWav * * * * * playSdWav7; * * 
AudioPlaySdWav * * * * * playSdWav8; * * 
AudioPlaySdWav * * * * * playSdWav9; * * 
AudioPlaySdWav * * * * * playSdWav10; * * 
AudioPlaySdWav * * * * * playSdWav11; * * 
AudioPlaySdWav * * * * * playSdWav12; * * 
AudioPlaySdWav * * * * * playSdWav13; * * 
AudioPlaySdWav * * * * * playSdWav14; * * 
AudioPlaySdWav * * * * * playSdWav15; * * 
AudioPlaySdWav * * * * * playSdWav16; * * 
AudioOutputTDM * * * * * tdm1;
AudioConnection * * * * *patchCord1(playSdWav1, 0, tdm1, 0);
AudioConnection * * * * *patchCord2(playSdWav2, 0, tdm1, 1);
AudioConnection * * * * *patchCord3(playSdWav3, 0, tdm1, 2);
AudioConnection * * * * *patchCord4(playSdWav4, 0, tdm1, 3);
AudioConnection * * * * *patchCord5(playSdWav5, 0, tdm1, 4);
AudioConnection * * * * *patchCord6(playSdWav6, 0, tdm1, 5);
AudioConnection * * * * *patchCord7(playSdWav7, 0, tdm1, 6);
AudioConnection * * * * *patchCord8(playSdWav8, 0, tdm1, 7);
AudioConnection * * * * *patchCord9(playSdWav9, 0, tdm1, 8);
AudioConnection * * * * *patchCord10(playSdWav10, 0, tdm1, 9);
AudioConnection * * * * *patchCord11(playSdWav11, 0, tdm1, 10);
AudioConnection * * * * *patchCord12(playSdWav12, 0, tdm1, 11);
AudioConnection * * * * *patchCord13(playSdWav13, 0, tdm1, 12);
AudioConnection * * * * *patchCord14(playSdWav14, 0, tdm1, 13);
AudioConnection * * * * *patchCord15(playSdWav15, 0, tdm1, 14);
AudioConnection * * * * *patchCord16(playSdWav16, 0, tdm1, 15);

// Use these with the Teensy Audio Shield
#define SDCARD_CS_PIN * *10
#define SDCARD_MOSI_PIN *11
#define SDCARD_SCK_PIN * 13
#define SDCARD_MISO_PIN *12

const int finger_delay = 5;
const int hand_delay = 220;
int chordnum=0;
const int freqOutputPin = 9;
const int rst = 5;

void setup() {
* delay(700);
* AudioMemory(100);
* pinMode (slaveAPin, OUTPUT);
* digitalWrite(slaveAPin,HIGH);
* pinMode (rst, OUTPUT);
* digitalWrite(rst,1);
* delay(300);
* SPI.begin();
* digitalWrite(rst,0);
* delay(300);
* digitalWrite(rst,1);
* delay(300);
* ad1934_configure();
* delay(700);
* for(int i=0;i<17;i++)
* {
* * Serial.print("\nregister : ");
* * Serial.print(i);
* * Serial.print(" : ");
* * Serial.print(ad1934_read(i));
* }
* delay(700);
* 
* SPI.setMOSI(SDCARD_MOSI_PIN);
* SPI.setSCK(SDCARD_SCK_PIN);
* SPI.setMISO(SDCARD_MISO_PIN);
* if (!(SD.begin(SDCARD_CS_PIN))) {
* * // stop here, but print a message repetitively
* * while (1) {
* * * Serial.println("Unable to access the SD card");
* * * delay(500);
* * }
* }
}
void loop() {

* * if (playSdWav1.isPlaying() == false) {
* * Serial.println("Start playing 1");
* * playSdWav1.play("SDTEST1.WAV");
* * delay(10); // wait for library to parse WAV info
* }
* * if (playSdWav2.isPlaying() == false) {
* * Serial.println("Start playing 1");
* * playSdWav2.play("SDTEST1.WAV");
* * delay(10); // wait for library to parse WAV info
* }
* 
}

I suppose to do like the picture below :
ad1934_daisychain.PNG
 
Status
Not open for further replies.
Back
Top