-
Notifications
You must be signed in to change notification settings - Fork 33
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
SAI: audio pll, sai peripheral driver, and small rtic synthesizing sample #143
Open
SpinFast
wants to merge
8
commits into
imxrt-rs:main
Choose a base branch
from
SpinFast:imxrt-sai
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on Jun 26, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 5bfb251 - Browse repository at this point
Copy the full SHA 5bfb251View commit details -
Configuration menu - View commit details
-
Copy full SHA for 386945c - Browse repository at this point
Copy the full SHA 386945cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a93a4c - Browse repository at this point
Copy the full SHA 0a93a4cView commit details -
Add pll4 clock module and sai clock modules
Provides a pll4 reset function with all the options to set the div_select, num, denom values with asserts ensuring bounds are kept based on the data sheet. It would be nice to assert these at compile time if possible and could be a future improvement to ensure the pll options are valid. The sai clock gating, selection, and divisor settings are also added enabling the full clocking of a sai peripheral from the audio pll to the peripheral input clock. The board clocks for sai1 are setup to generate an appropriate clock for a 48KHz 16bit stereo i2s stream by default that a wolfson wm8960 codec can pick up for playback.
Configuration menu - View commit details
-
Copy full SHA for d759d38 - Browse repository at this point
Copy the full SHA d759d38View commit details -
SAI can be modeled like a UART in some regards where there are a Tx/Rx pair. Unlike a UART though SAI in iMXRT can have multiple data channels connected to the same peripheral. While each channel has its own fifo and pin they are still part of the same peripheral instance. Meaning the clock, status, FIFO watermark, and more are all the shared. This adds some complications. Use of the Tx and Rx together is also optional, its quite possible only Tx or Rx in use. So modeling this API requires some interesting use of generics, but in effect the Sai struct is a builder that enables building a Sai Tx/Rx optional pair given pins and builder like options. The goal in the end is to have static const generated register fields from perhaps a const fn friendly builder type (SaiConfig). From there a Tx/Rx pair provide functionality for writing frames of audio samples per channel, managing interrupt masks, checking status, and enabling/disabling the transmitter or receiver. In some instances the Tx/Rx pair are *synchronized* meaning between the pair one will drive the frame sync clock of the other. This leads to a small potential race at the moment if a Tx and Rx are setup as synchronized and the tx/rx is enabled/disabled independent of the other that I can see. I don't have a great way of solving this particular setup in a safe way at the moment.
Configuration menu - View commit details
-
Copy full SHA for 7aca2b9 - Browse repository at this point
Copy the full SHA 7aca2b9View commit details -
SAI example with wolfson wm8960 codec
Provides a sample application for playing back audio without DMA directly writing to the FIFO of the SAI peripheral, which should result in an I2S signaling to the WM8960 codec on the EVK boards. The codec should then output a nice square wave on one channel and a sine wave on the other. The example in this case uses a PIT timer to print the status and a SAI1 interrupt noting a FIFO request to synthesize samples when needed.
Configuration menu - View commit details
-
Copy full SHA for 3fd5e9d - Browse repository at this point
Copy the full SHA 3fd5e9dView commit details
Commits on Jun 28, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 8c555e8 - Browse repository at this point
Copy the full SHA 8c555e8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e4ce04 - Browse repository at this point
Copy the full SHA 0e4ce04View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.