arduino / arduino/ArduinoCore-samd
I2S Library clocking improvements
- Dominant language
- C
- Stars
- 502
- Forks
- 740
- PR merge metrics
- No merged PRs in 30d
Description
Nice to see the recent edition of the I2S library -- it's a neat little feature of the D21 and is more flexible then what's included on the SAM3 in the DUE. The example project connects to a device that doesn't require an MCLK (cool!), but it would be great to have a little more flexibility in the clocking to allow for connection to other devices.
The first change I'd like to make is adding an MCLK pin option. Many codecs need this to operate. The D21 includes a fractional PLL which can generate the MCLK for standard audio sampling frequencies. Configuration of the PLL is probably beyond the scope of the I2S lib, but small mods could be made to the existing lib to allow this to be the source clock (rather than the system clock), which would allow the part to output the proper MCLK clock to the external codec.
The second change is adding an additional overloaded begin() method that would take a new clock config argument. The clock config argument could be something like the SPISettings() class that would offer more options, but provide a basic default for an simple use cases. This could be used to set clock dividers for more granular control (and could help setup the mclk stuff from above).
All in all, I think the code changes would be fairly minimal. I don't mind putting out a PR for this, but since this is a new module there may be additional changes in the works that I am not aware of (or perhaps this is out of scope). If this is interesting/useful, I'll go ahead and code something up and submit for review.
Contributor guide
No contributing guide indexed for this repository
Research direction
Review the I2S library and its example project first, then trace the existing clock setup and begin() entry points. The requested outcome is an optional MCLK pin and a clock-configuration argument for finer divider control, but the scope and API design need clarification before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100