I2S MLCK Clock problem on nrf5340

Hello. I use nrf5340 audio development kit with Zephyr OS. I configured I2S peripheral as master and sample frequency 44100 Hz. Using oscilloscope i measured that SCLK and MCK are 1.4 MHz. That's fine but my codec requires 11.2896 MHz MCLK. So in zephyr driver i2s_nrfx.c i commented out all ratios except  x256. 

ratios[] = {
   //              {  32, NRF_I2S_RATIO_32X },
   //              {  48, NRF_I2S_RATIO_48X },
   //              {  64, NRF_I2S_RATIO_64X },
   //              {  96, NRF_I2S_RATIO_96X },
   //              { 128, NRF_I2S_RATIO_128X },
   //              { 192, NRF_I2S_RATIO_192X },
                   { 256, NRF_I2S_RATIO_256X },
   //              { 384, NRF_I2S_RATIO_384X },
   //              { 512, NRF_I2S_RATIO_512X }
           };

At this point I got the following message via UART: 

I2S MCK frequency: 11289600, actual PCM rate 44100.

But when I meassured clock pin, clock was not present. And since SCLK and WCLK are derived from MCK, they are not present too. I tried to change CLK source at the overlay file, but that didn't help to. When I reduced to ratio to 128 and 64, I successfully got 2.8 MHz and 5.6 MHz clocks. In overlay file at clock node hfclkaudio-frequency = <11289600>;

Parents
  • Hi. Thanks for the replay. Initialy clock was present when all ratios were present but the problem is MCLK and SClK are both 1.4 MHz. I need 11.286 Mhz for MCK, and since sample rate is 44.1 kHz SCLK frequency needs to stay at 1.4MHz. So, because I wanted to have MCLK that oscilates at different radio than SCLK, I figured that I can comment  elements of array. If I comment all elements but let's say 64x, I will get 2.8 Mhz MCLK clock and SCLK will be 1.4MHz. If I comment all elements but 128x I will get 5.6Mhz MCLK clock and 1.4 SCLK. But when I commented all elements but 256X MHz clocks were not present. 

Reply
  • Hi. Thanks for the replay. Initialy clock was present when all ratios were present but the problem is MCLK and SClK are both 1.4 MHz. I need 11.286 Mhz for MCK, and since sample rate is 44.1 kHz SCLK frequency needs to stay at 1.4MHz. So, because I wanted to have MCLK that oscilates at different radio than SCLK, I figured that I can comment  elements of array. If I comment all elements but let's say 64x, I will get 2.8 Mhz MCLK clock and SCLK will be 1.4MHz. If I comment all elements but 128x I will get 5.6Mhz MCLK clock and 1.4 SCLK. But when I commented all elements but 256X MHz clocks were not present. 

Children
Related