Technical Inquiry About Configuring I2S MCLK

Dear Nordic Semiconductor Team,

Hello! I have been exploring your I2S sample code, specifically the example located at “C:\ncs\v2.4.2\zephyr\samples\drivers\i2s\echo”. While I have gained a good understanding of most parts, I am encountering some difficulties in configuring the MCLK (Master Clock) for I2S.

I noticed that the sample code does not seem to explicitly mention how to configure the MCLK output. Given the importance of the MCLK in the overall I2S communication, I am seeking specific guidance on how to correctly set up the MCLK.

It would be greatly helpful if you could provide relevant code examples or configuration instructions for this. Thank you for your support and assistance. I look forward to your response.

Best regards, [Your Name] [Your Contact Information, such as email, phone number, etc.]

  • Hi, I confirmed that the configuration of the bit width is indeed incorrect; I wanted to be able to configure it as a 24bit bit width, and the original code should have NRF_I2S_SWIDTH_24BIT_IN32BIT; so I put SAMPLE_BIT_WIDTH = 32 in the code behind;

    Again, sorry for misleading you with another mistake!

    Also, regarding the bypass issue, my considerations are located in the nRF5340 datasheet's FIGURE 63, where the figure shows that turning on config.bypass,allows to connect the pesl.mck directly to the clock source, i.e., hfclk or aclk; in PAGE 265, 7.15.10.27 CONFIG. CLKCONFIG description also says that when bypass is enabled, MCK will be equal to source input.

    I just accidentally clicked on the "Verify Answer" button, but my mclk output problem is still not solved, I hope to continue to get your help!

  • Hi 

    Thanks for the clarification.

    Looking at your various requirements, including the NRF_I2S_SWIDTH_24BIT_IN32BIT bit mode, I don't think you will be able to replicate these settings successfully using the Zephyr I2S driver. 

    The Zephyr driver is quite generic since it is made to support a wide range of hardware devices, and doesn't expose all the functionality of the I2S peripheral in the nRF devices. 

    In your case I believe you are better of using the nrfx_i2s driver directly, skipping the standard Zephyr driver. We also do this in the LE Audio application because the standard driver doesn't provide enough control over the hardware. 

    Best regards
    Torbjørn

  • Thank you so much for your patience and detailed response, it was very helpful!

  • You welcome, the best of luck with your project Slight smile

Related