-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
soc: added nxp rw soc i2s clock init #87477
base: main
Are you sure you want to change the base?
soc: added nxp rw soc i2s clock init #87477
Conversation
Hello @JoeyFreeland-DojoFive, and thank you very much for your first pull request to the Zephyr project! |
@DerekSnell @dleach02 @mmahadevan108 I'm not sure that using the FRG is the right thing to do. At 44.1KHz sampling rate, the actual clock rate differs from the calculated clock rate by 1.2%. It may be that using the AVPLL is the right thing to do? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @JoeyFreeland-DojoFive ,
Thank you for contributing this. I do see that the MCUXpresso SDK I2S examples clock the Flexcomm from the Audio PLL. And currently in Zephyr in this SOC, the Audio PLL also clocks the DMIC. So it makes sense both the DMIC and I2S are using the same clock source.
Also, you will need to fix the compliance issues to pass CI so we can merge this. Thanks again
@DerekSnell This is going to be problematic though... the PLL selection will really depend on what sampling rate your audio is at. For example, if you are doing 44.1KHz audio, you'll want the audio PLL to be at 11.2896 MHz since that perfectly divides into a 44.1KHz clock. However, if you are using 48Khz, you will want an audio PLL of 12.288 MHz. Since this clock init happens before the I2S init, I'm not sure how that could work. Unless the I2S init function re-configures the audio PLL. Thoughts? This is where the Zephyr board abstractions start to break down a little bit. |
I2S clock init was missing from the NXP RW soc file. Signed-off-by: Joey Freeland <joey.freeland@dojofive.com>
9609aaf
to
9ee1026
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DerekSnell This is going to be problematic though... the PLL selection will really depend on what sampling rate your audio is at.
Hi @JoeyFreeland-DojoFive , you are right. There is no single clock config that can meet the needs of every use-case. Configuring the SOC clocks should be done by the application. This clock_init()
is declared as weak
so custom boards and apps can override it.
I am fine with either option, the Audio PLL or FRGs. To me, the goals of this SOC clock_init()
are to enable as much as we can for ease of use, enable the unit tests for CI, and provide guidance for using the SOC. Therefore, I approve.
Thank you
I'm having problems getting the AVPLL setup. The output is not matching what I'm configuring it as. I'm going to get that sorted out before pushing this across the finish line. |
@DerekSnell I have tested on my custom IRIS-W10 board, and the |
Hi @JoeyFreeland-DojoFive , You can also use the MCUXpresso Config Tool with the Clock Config tool to configure the Audio PLL for the FRDM-RW612 board. These are snippets from the GUI in the Clock Config tool for configuring the Audio PLL: Thanks for working on this. Best regards |
@DerekSnell I still feel like something is up here. I was able to get the I2S examples working on my FRDM-RW612 just fine, building and launching through MCUExpresso. I am even able to get the AVPLL working fine on Zephyr, using my |
@DerekSnell I tried using MCUExpresso again (without Zephyr), and I modified the example I2S project to build with |
@DerekSnell I have come probably as far as I want to go on this. I added It's tough to determine whether or not this issue is in-scope with this PR. The Wifi shell example does enable |
Sorry @JoeyFreeland-DojoFive , I built and ran the tests/drivers/i2s/i2s_speed test on the Sorry to do this after all your work, but now that I am aware of this downstream code and clock config, I am blocking your PR. Since the downstream clocks the I2S Flexcomms from the Audio PLL, I do not think we should merge this PR clocking from the FRGs. Thanks again for your contribution and all your efforts. If you change your PR to match the downstream, I'll be happy to approve this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the downstream clocks the I2S Flexcomms from the Audio PLL, I do not think we should merge this PR clocking from the FRGs.
@DerekSnell we should not block upstream community contributions based on something from the downstream, if the downstream and upstream don't match, that is our fault. The i2s was enabled in the downstream for a long time and I don't know why it wasn't upstreamed. In fact I think some of the original commits were even dropped from the downstream during some history rewrite, so this has been managed poorly on the NXP side. I am okay with this PR to merge then @EmilioCBen is already going to look at it more closely and add testing support of the i2s. |
Also - skimming over I would love to get to a point where you've recreated my issue, because I do think it is important. But I don't have the bandwidth within my professional work to do that right now. Basically I took the I2S sample from the The best option is for sure to use the AVPLL for the clock source. The FRG can get you close, but the whole reason the AVPLL exists is to get your sampling rates exact. I think the ultimate solution would be both a modification to |
Hey @JoeyFreeland-DojoFive |
Discussing with @decsny , he raises a good point above, and I want to clarify why I blocked this PR. The reason I am blocking this is not only because the code differs from NXP's downstream. Earlier in the discussion, both @JoeyFreeland-DojoFive and I agreed that clocking from the Audio PLL is ideal. That is also how the I2S is clocked in the MCUXpresso SDK examples, and in the downstream repo. And Joey already had 3 approvals for this PR clocking from the FRGs, but was still working to use the Audio PLL instead for better frequncy accuracy. Since the preferred solution is to clock from the audio PLL, I blocked the approved PR to prevent someone else from merging it. And now NXP recognizes that the I2S feature in the downstream was not upstreamed, and NXP plans to upstream this now, so Joey does not need to be burdened by this. And @JoeyFreeland-DojoFive , thanks for clarifying about the audio PLL accuracy with optimizations. I assumed that "the AVPLL fails to complete calibration" meant the app stopped executing with this failure. So I will investigate the audio PLL frequency in the i2s_speed test, and try to replicate the issue. Best regards |
I have added the changes here #87773 |
I2S clock init was missing from the NXP RW soc file. I2S clock init was added to all five flexcomm interfaces. Addresses #87239.