Skip to content

embassy-rp: Make bit-depth of I2S PIO program configurable #4193

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

embediver
Copy link
Contributor

The PioI2sOutProgram had a fixed 16bit sample depth, but that isn't reflected in the types name or the documentation.

The PioI2sOut output driver on the other hand accepts a bit_depth argument.
This was previously only used to calculate the clock frequency, while no other values than 16 made any sense.

This MR implements setting the sample bit-depth by setting it to scratch register Y, from where it is read by the PIO program.

Also the channel argument is removed, since only 2 channels are supported.

embediver added 2 commits May 13, 2025 22:36
Also the channel argument is removed, since only 2 channels are supported.
@Dirbaio
Copy link
Member

Dirbaio commented May 13, 2025

Also the channel argument is removed, since only 2 channels are supported.

what do you mean with this? Was "other than 2 channels" already unsupported before, or does it become unsupported with your changes?

If the latter, maybe we should find a way to make channel count and bit depth configurable.

@embediver
Copy link
Contributor Author

Channel count wasn't really supported before and I don't think I2S could support it.
Atleast I don't know how I2S with only one channel would have to look, since a word clock (which is also the left/right clock) is mandatory.
And more than two channels is definitely not supported by standard I2S.

The channel argument was only used to calculate the clock frequency by calculating sample_rate * bit_depth * channel_count.
So now its just a fixed x2 in the calculation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants