For an audio application, I need to configure the SAI peripherals and the GPT so that the peripheral clock frequency is exactly the same - for example 12.288 MHz.
I was unable to obtain this result. The best solution I found was:
- configure PLL2 as 24*(22+85/161) and supply it to the core and the GPT (divided by 44)
- configure PLL4 as 24*(32+92/119) and supply it to SAI ports (divided by 64)
These frequency are close, but not the same, and this may create artifacts in the audio signal.
Another possible solution could be to output peripheral clock root to CLKO1 and feed it back to CCM_CLK. Honestly I don't like it, because so far we have had various robustness problems with CCM.
A third, and possible best solution is to use a 24.576 MHz crystal instead than 24 MHz.
This is not explicitly permitted on the datasheet, but it is not even explicitly forbidden.
So, the question is: can I use a 24.576 MHz crystal as main clock for the RT1051? Should I expect any drawbacks?
Thanks
Hi Giuseppe
If you require the SAI and GPT clocks to be synchronous you could source them both from PLL3.
Use PLL3's 480MHz output for PERIPH_CLK/AHB_CLK_ROOT, which supplies PERCLK_CLK_ROOT (GPT)
and configure PLL3-PFD1 to also output 480MHz to supply the SAI clock root with its fraction value set to 18.
The exact frequency obtained can then be set in the clock paths and the peripherals - I don't know which exact frequencies are possible but the clocks would be correctly synchronised.
Regards
Mark
[uTasker project developer for Kinetis and i.MX RT]
Hello ,
Hope you are doing well.
Unfortunately this will not be possible as there are many other peripherals that were designed around the 24 MHz oscillator. The SDK is required to be used with a 24 MHz, so it will not properly and some peripheral functionality may be jeopardized. I recommend to use the clock config tool that is provided in our website or if you are using MCUXpresso, you can select your project and click on the Open Clocks option.
There is a clock diagram that allows you to make the changes to the clock configuration while complying with the requirements of all the peripherals. The tool will help by providing warnings or errors if a configuration is not possible.
It is possible to achieve the same clock for the GPT and SAI peripheral, considering the other peripherals that have to have a certain output frequency as well. Is the 12.288 MHz a hard requirement or is it possible to work with 12MHz?
Hope it helps!
Sabina
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Sabina, thank you for your answer.
I am aware of the clock configuration tool, in facts I've already used it in other projects.
At the moment I wasn't able to find a configuration where SAI and GPT may have the same clock, but I'll try again.
12.288 MHz is a hard requirement, commonly found in professional audio applications (everything must be multiple of the sampling frequency 48/96 kHz).
Giuseppe
Thank you for clarifying I will keep attempting to get to this desired frequency. I have so far been able to achieve 12.279 on both exactly the same. I will let you know if I achieve the frequency you are looking for.
I am also confirming the degree of impact that the other peripherals will be subject to by using the 24.576MHz crystal. I will update you as soon as I get a response.
Best Regards,
Sabina
I was able to get the desired audio frequencies, with the drawback of running the core at 540 MHz instead than 600 (but I don't think I can avoid this).
Here is my configuration:
1) system PLL
2) PERCLK set to 12.288 MHz
3) Audio PLL set to a multiple of 12.288 MHz
This should be acceptable even if the frequencies come from two different clock chains.