Преглед на файлове

Support other CPU speeds in ADC & DAC

dds
PaulStoffregen преди 10 години
родител
ревизия
6bdf3a0945
променени са 3 файла, в които са добавени 24 реда и са изтрити 1 реда
  1. +3
    -0
      gui/list.html
  2. +3
    -0
      output_pwm.cpp
  3. +18
    -1
      utility/pdb.h

+ 3
- 0
gui/list.html Целия файл

@@ -341,6 +341,9 @@
C0G/NPO ceramic capacitor should be used for filtering. Low
quality ceramic (X7R, Y5V, Z5U, etc) can cause signal distortion.</p>
<h3>Notes</h3>
<p>This object only works properly when Tools > CPU_Speed is set to
48 or 96 MHz. Other speeds aren't supported and will likely fail
in strange ways.</p>
<p>The PWM carrier frequency is 88.2 kHz. The suggested circuit
will only slightly filter the carrier. Extra filtering will be
required for a clean signal without the ultrasonic PWM carrier.

+ 3
- 0
output_pwm.cpp Целия файл

@@ -35,6 +35,9 @@ uint8_t AudioOutputPWM::interrupt_count = 0;
DMAMEM uint32_t pwm_dma_buffer[AUDIO_BLOCK_SAMPLES*2];
DMAChannel AudioOutputPWM::dma;

// TODO: this code assumes F_BUS is 48 MHz.
// supporting other speeds is not easy, but should be done someday

void AudioOutputPWM::begin(void)
{
dma.begin(true); // Allocate the DMA channel first

+ 18
- 1
utility/pdb.h Целия файл

@@ -27,11 +27,28 @@
#ifndef pdb_h_
#define pdb_h_

#include "kinetis.h"

// Multiple input & output objects use the Programmable Delay Block
// to set their sample rate. They must all configure the same
// period to avoid chaos.

#define PDB_CONFIG (PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT)
#define PDB_PERIOD 1087 // 48e6 / 44100

#if F_BUS == 60000000
#define PDB_PERIOD (1360-1)
#elif F_BUS == 56000000
#define PDB_PERIOD (1269-1) // 0.026% error
#elif F_BUS == 48000000
#define PDB_PERIOD (1088-1)
#elif F_BUS == 36000000
#define PDB_PERIOD (816-1)
#elif F_BUS == 24000000
#define PDB_PERIOD (544-1)
#elif F_BUS == 16000000
#define PDB_PERIOD (363-1) // 0.092% error
#else
#error "Unsupported F_BUS speed"
#endif

#endif

Loading…
Отказ
Запис