AnsweredAssumed Answered

X-CUBE-SOUNDTER1: how to set I2S clock?

Question asked by Marco Perciavalle on Nov 29, 2017
Latest reply on Nov 30, 2017 by Marco Perciavalle

Hi, I have a nucleo f401re board and a x-nucleo-cca01m1 shield mounting STA350BW IC. Nucleo transmits data as a master to the shield using I2S half duplex communication. I want to know what is Master Clock's purpose on I2S bus. I understand that it stands for an external clock for STA350BW, doesn't it? So does the IC work on this clock? 

In particular I want to understand the meaning of these settings referred to the master clock: 

if (AudioFreq == 96000)
{
rccclkinit.PLLI2S.PLLI2SN = 344;
rccclkinit.PLLI2S.PLLI2SR = 2;
HAL_RCCEx_PeriphCLKConfig(&rccclkinit);
}
else if (AudioFreq == 48000)
{
rccclkinit.PLLI2S.PLLI2SN = 258;
rccclkinit.PLLI2S.PLLI2SR = 3;
HAL_RCCEx_PeriphCLKConfig(&rccclkinit);
}
else if (AudioFreq == 44100)
{
rccclkinit.PLLI2S.PLLI2SN = 271;
rccclkinit.PLLI2S.PLLI2SR = 2;
HAL_RCCEx_PeriphCLKConfig(&rccclkinit);
}
else if (AudioFreq == 32000)
{
rccclkinit.PLLI2S.PLLI2SN = 213;
rccclkinit.PLLI2S.PLLI2SR = 2;
HAL_RCCEx_PeriphCLKConfig(&rccclkinit);
}

(x_nucleo_cca01m1_audio_f4.c)

Thanks for any answers. Best regards.

Outcomes