Hi there! I am building a synthesizer instrument using the Teensy 4.1 and Audio Shield, connected to each other via stacking headers and socketed into a PCB containing several potentiometer and button inputs and I2C peripherals (external ADC, DAC, OLED).
I recently went to get an FCC Part 15 B radiated emissions test and got very strong, seemingly harmonically spaced peaks in both the 30-200MHz and 200M-1GHz ranges. My worst offenders being 173, 192, 274 and 422 MHz (images below)... I am using code from El Supremo (attached below) to set my I2S audio sample rate from the default 44100 to 96000 to avoid high frequency aliasing. I suspect that the MCLK of I2S is the main culprit, given these frequencies are close-ish to integer multiples of the resulting 24.576MHz MCLK i'd get from the oversampling.
While I definitely have room to improve my enclosure's shielding and PCB-chassis ground tie-in to mitigate this noise, and I've attempted using the following code to change slew rate and gain of the MCLK, LRCLK, and BCLK - is there anything else obvious I can try to reduce the amplitude of these ringings? Or is there something else I may be missing that is contributing to this noise?
Thanks in advance!
~Joe
I recently went to get an FCC Part 15 B radiated emissions test and got very strong, seemingly harmonically spaced peaks in both the 30-200MHz and 200M-1GHz ranges. My worst offenders being 173, 192, 274 and 422 MHz (images below)... I am using code from El Supremo (attached below) to set my I2S audio sample rate from the default 44100 to 96000 to avoid high frequency aliasing. I suspect that the MCLK of I2S is the main culprit, given these frequencies are close-ish to integer multiples of the resulting 24.576MHz MCLK i'd get from the oversampling.
While I definitely have room to improve my enclosure's shielding and PCB-chassis ground tie-in to mitigate this noise, and I've attempted using the following code to change slew rate and gain of the MCLK, LRCLK, and BCLK - is there anything else obvious I can try to reduce the amplitude of these ringings? Or is there something else I may be missing that is contributing to this noise?
Thanks in advance!
~Joe
C++:
void setI2SPadSafeProfile() {
// apply ALT0 for I2S0 on each pin
for (int i=0;i<3;i++) *(mux_regs[i]) = 0;
// Helper to set SRE=0 and DSE to chosen value
auto setPad = [](volatile uint32_t *padReg, uint8_t dseVal, uint8_t sreVal){
uint32_t p = *padReg;
p &= ~((7u << 3) | (1u << 0)); // clear DSE[3..5], SRE[0]
p |= ((uint32_t)(dseVal & 0x7) << 3);
if (sreVal & 1u) p |= (1u << 0); // set fast if requested; else leave slow
*padReg = p;
};
// Choose values (tweak after listening)
setPad(pad_regs[IDX_MCLK], 3, 0); // MCLK DSE=3 (~48Ω), slow
setPad(pad_regs[IDX_BCLK], 1, 0); // BCLK DSE=1 (~34Ω), slow
setPad(pad_regs[IDX_LR], 1, 0); // LRCLK DSE=1, slow
// setPad(pad_regs[IDX_TXD], 1, 0); // TXD0 DSE=1, slow
}
C++:
#include <utility/imxrt_hw.h>
int setI2SFreq(int freq) {
int n1;
// PLL between 27*24 = 648MHz und 54*24=1296MHz
// Fudge to handle 8kHz - El Supremo
if (freq > 8000) {
n1 = 4; //SAI prescaler 4 => (n1*n2) = multiple of 4
} else {
n1 = 8;
}
int n2 = 1 + (24000000 * 27) / (freq * 256 * n1);
Serial.println(n2);
if (n2 > 63) {
// n2 must fit into a 6-bit field
Serial.printf("ERROR: n2 exceeds 63 - %d\n", n2);
return 0;
}
double C = ((double)freq * 256 * n1 * n2) / 24000000;
// Serial.printf("%6d : n1 = %d, n2 = %d, C = %12.6f ",freq,n1,n2,C);
int c0 = C;
int c2 = 10000;
int c1 = C * c2 - (c0 * c2);
// Serial.printf("c0 = %d, c1 = %d, c2 = %d\n",c0,c1,c2);
set_audioClock(c0, c1, c2, true);
CCM_CS1CDR = (CCM_CS1CDR & ~(CCM_CS1CDR_SAI1_CLK_PRED_MASK | CCM_CS1CDR_SAI1_CLK_PODF_MASK))
| CCM_CS1CDR_SAI1_CLK_PRED(n1 - 1) // &0x07
| CCM_CS1CDR_SAI1_CLK_PODF(n2 - 1); // &0x3f
//START//Added afterwards to make the SAI2 function at the desired frequency as well.
CCM_CS2CDR = (CCM_CS2CDR & ~(CCM_CS2CDR_SAI2_CLK_PRED_MASK | CCM_CS2CDR_SAI2_CLK_PODF_MASK))
| CCM_CS2CDR_SAI2_CLK_PRED(n1 - 1) // &0x07
| CCM_CS2CDR_SAI2_CLK_PODF(n2 - 1); // &0x3f)
//END//Added afterwards to make the SAI2 function at the desired frequency as well.
// For compatibility with my T3.6 version
return freq;
}