I2S STM32 Sampling frequency different from what reference manual states, why?
Hi Guys, in the reference sheet of the STM32H753ZI Pg. 2212 it says
"FWS is the audio sampling
frequency."
There's a programing example provided at Pg. 2232 that says Sampling Freq = 48kHz.
I tried this exact configuration, the MCLK, FWS, and SCLK are all correct, however when I see the sampling frequency its double of the FW?
The green signal is the On and Off when the DMA triggers. Sample buffer is length of 4
so it will trigger at 2 and 4. High is Complete and Low is Half Complete
Yellow signal is the FWS
CODE: MAIN()
uint16_t RxBuff[4];
uint16_t TxBuff[4];
uint8_t TC_Callback = 0;
uint8_t HC_Callback = 0;
char uartBuff[8];
void DMA1_Stream0_IRQHandler(void) {
if (((DMA1 -> LISR) & (DMA_LISR_TCIF0)) != 0){
DMA1 -> LIFCR |= DMA_LIFCR_CTCIF0;
TC_Callback = 1;
}
else if (((DMA1 -> LISR) & (DMA_LISR_HTIF0)) != 0){
DMA1 -> LIFCR |= DMA_LIFCR_CHTIF0;
HC_Callback = 1;
}
}
int main(void) {
init_Clock();
init_I2S();
init_Debugging();
init_Interrupt();
init_SpeedTest();
while (1)
{
if (HC_Callback == 1){
GPIOA->BSRR |= GPIO_BSRR_BS3_HIGH;
HC_Callback = 0;
} else if (TC_Callback == 1){
GPIOA->BSRR |= GPIO_BSRR_BR3_LOW;
TC_Callback = 0;
}
}
}The math to find out the F_sample (Green Signal)
Half Complete triggers every 20.6uS for every 2 Samples.
Thus in 1 second 97kSamples are obtained, which is close to 96kSamples and not 48kSamples as it was suggested from the reference manual
UPDATE 1:
I have tried making FWS = 96kHz this caused the sampling frequency to be closed to 192khz so it looks like the sampling frequency for I2S is FWS*2?
