Przeglądaj źródła

Fix TDM input on Teensy 4.0

dds
PaulStoffregen 5 lat temu
rodzic
commit
c5a33a0049
2 zmienionych plików z 10 dodań i 7 usunięć
  1. +4
    -5
      input_tdm.cpp
  2. +6
    -2
      output_tdm.cpp

+ 4
- 5
input_tdm.cpp Wyświetl plik

@@ -27,7 +27,7 @@
#include <Arduino.h>
#include "input_tdm.h"
#include "output_tdm.h"
#if defined(KINETISK) || defined(__IMXRT1052__) || defined(__IMXRT1062__)
#if defined(KINETISK) || defined(__IMXRT1062__)
#include "utility/imxrt_hw.h"

DMAMEM __attribute__((aligned(32)))
@@ -66,8 +66,8 @@ void AudioInputTDM::begin(void)
I2S0_RCSR |= I2S_RCSR_RE | I2S_RCSR_BCE | I2S_RCSR_FRDE | I2S_RCSR_FR;
I2S0_TCSR |= I2S_TCSR_TE | I2S_TCSR_BCE; // TX clock enable, because sync'd to TX
dma.attachInterrupt(isr);
#else
CORE_PIN7_CONFIG = 3; //RX_DATA0
#elif defined(__IMXRT1062__)
CORE_PIN8_CONFIG = 3; //RX_DATA0
IOMUXC_SAI1_RX_DATA0_SELECT_INPUT = 2;
dma.TCD->SADDR = &I2S1_RDR0;
dma.TCD->SOFF = 0;
@@ -84,8 +84,7 @@ void AudioInputTDM::begin(void)
update_responsibility = update_setup();
dma.enable();

I2S1_RCSR |= I2S_RCSR_RE | I2S_RCSR_BCE | I2S_RCSR_FRDE | I2S_RCSR_FR;
I2S1_TCSR |= I2S_TCSR_TE | I2S_TCSR_BCE;
I2S1_RCSR = I2S_RCSR_RE | I2S_RCSR_BCE | I2S_RCSR_FRDE | I2S_RCSR_FR;
dma.attachInterrupt(isr);
#endif
}

+ 6
- 2
output_tdm.cpp Wyświetl plik

@@ -91,8 +91,8 @@ void AudioOutputTDM::begin(void)
update_responsibility = update_setup();
dma.enable();

I2S1_RCSR |= I2S_RCSR_RE;
I2S1_TCSR |= I2S_TCSR_TE | I2S_TCSR_BCE | I2S_TCSR_FRDE;
I2S1_RCSR |= I2S_RCSR_RE | I2S_RCSR_BCE;
I2S1_TCSR = I2S_TCSR_TE | I2S_TCSR_BCE | I2S_TCSR_FRDE;

#endif
dma.attachInterrupt(isr);
@@ -271,6 +271,10 @@ void AudioOutputTDM::config_tdm(void)

#elif defined(__IMXRT1062__)
CCM_CCGR5 |= CCM_CCGR5_SAI1(CCM_CCGR_ON);

// if either transmitter or receiver is enabled, do nothing
if (I2S1_TCSR & I2S_TCSR_TE) return;
if (I2S1_RCSR & I2S_RCSR_RE) return;
//PLL:
int fs = AUDIO_SAMPLE_RATE_EXACT;
// PLL between 27*24 = 648MHz und 54*24=1296MHz

Ładowanie…
Anuluj
Zapisz