I'm trying to slow down the PDB to something a lot slower - 8kHz.
I've found (I think) where the PDB is set for 44.1kHz in input_adc.cpp and output_dac.cpp.
PDB_CONFIG in utility\pdb.h.
I don't see where PDB_PERIOD is set for 180Mhz in utility\pdb.h. Does it use the default value in PDBx_MOD?
Also, what is the formula for changing the PDB? From the PDBx_SC register.
(1/180MHz/PRESCALRER/MULTI) * PDBx_MOD?
Will changing these settings have any other adverse side-effects when using the audio library?
Lastly, when should these registers be changed? In my mind, this is the last thing in the setup function before moving to the loop.
I've found (I think) where the PDB is set for 44.1kHz in input_adc.cpp and output_dac.cpp.
Code:
// set the programmable delay block to trigger the ADC at 44.1 kHz
#if defined(KINETISK)
if (!(SIM_SCGC6 & SIM_SCGC6_PDB)
|| (PDB0_SC & PDB_CONFIG) != PDB_CONFIG
|| PDB0_MOD != PDB_PERIOD
|| PDB0_IDLY != 1
|| PDB0_CH0C1 != 0x0101) {
SIM_SCGC6 |= SIM_SCGC6_PDB;
PDB0_IDLY = 1;
PDB0_MOD = PDB_PERIOD;
PDB0_SC = PDB_CONFIG | PDB_SC_LDOK;
PDB0_SC = PDB_CONFIG | PDB_SC_SWTRIG;
PDB0_CH0C1 = 0x0101;
}
#endif
PDB_CONFIG in utility\pdb.h.
Code:
#define PDB_CONFIG (PDB_SC_TRGSEL(15) | PDB_SC_PDBEN | PDB_SC_CONT | PDB_SC_PDBIE | PDB_SC_DMAEN)
I don't see where PDB_PERIOD is set for 180Mhz in utility\pdb.h. Does it use the default value in PDBx_MOD?
Also, what is the formula for changing the PDB? From the PDBx_SC register.
(1/180MHz/PRESCALRER/MULTI) * PDBx_MOD?
Will changing these settings have any other adverse side-effects when using the audio library?
Lastly, when should these registers be changed? In my mind, this is the last thing in the setup function before moving to the loop.