This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Change LRCK on fly for i2s on nrf5340

Hi, 

We want to change the LRCK frequency on nrf5340 on fly for i2s use case. We understand that we can achieve this by tweaking the MCKFREQ and ratio.

Will it be possible to configure LRCK to a non-standard rate like 49kHz?

When we tried to measure the difference between consecutive TX/Rx interrupts, we see that interval between the interrupt changes only for certain settings.

  • We want to change the LRCK frequency on nrf5340 on fly for i2s use case. We understand that we can achieve this by tweaking the MCKFREQ and ratio.

     What do you mean by "on the fly"? Do you mean during an I2S data stream, or is it acceptable to disable the I2S, reconfigure, then re-enable the I2S again? 

    Will it be possible to configure LRCK to a non-standard rate like 49kHz?

     Yes, see Master clock (MCK) for details.

    When we tried to measure the difference between consecutive TX/Rx interrupts, we see that interval between the interrupt changes only for certain settings.

    Can you elaborate? 

  • Hi haakonsh,

    Do you mean during an I2S data stream, or is it acceptable to disable the I2S, reconfigure, then re-enable the I2S again? 

    I mean during an I2S data stream. However, if we were to stop and start again, what is the expected delay in doing so?

    Can you elaborate

    We are directly accessing the EVENTS_TXPTRUPD/EVENTS_RXPTRUPD for tracking.

    For a given MAXCNT value, the interval between 2 consecutive EVENTS_TXPTRUPD is expected to change by equivalent proportion by which we modify the MCKFREQ and ratio. We are measuring these intervals using timer3. But, we see that for a range of LRCK value(say 48k to 50kHz), the interval between 2 consecutive EVENTS_TXPTRUPD is same. 

    Hence, we wanted to understand if non-standard sample rates can be achieved by changing the MCKFREQ value .

  • Divya BM said:
    I mean during an I2S data stream. However, if we were to stop and start again, what is the expected delay in doing so?

    You'll probably have to stop the PDM transfer to for a change in the PDMCLKCTRL register to take affect, It is not specified. Starting and stopping might take a minimum of 5ms due to the Decimation filter delay described in nRF52832's PDM Electrical Specification. The electrical specification for nRF5340 is not yet available. 

    Divya BM said:

    We are directly accessing the EVENTS_TXPTRUPD/EVENTS_RXPTRUPD for tracking.

    For a given MAXCNT value, the interval between 2 consecutive EVENTS_TXPTRUPD is expected to change by equivalent proportion by which we modify the MCKFREQ and ratio. We are measuring these intervals using timer3. But, we see that for a range of LRCK value(say 48k to 50kHz), the interval between 2 consecutive EVENTS_TXPTRUPD is same. 

    Hence, we wanted to understand if non-standard sample rates can be achieved by changing the MCKFREQ value .

     Have you scoped the MCK pin, that's the only way you'll know for sure what frequencies you'll get. You need to know the exact frequency outputted in order to trim PDMCLKCTRL anyways unless you're trimming it with HFCLKAUDIO.FREQUENCY. 

  • Hi

    i2s no stop, how to change i2s speed dynamic?

      

    Best regards

Related