-
Notifications
You must be signed in to change notification settings - Fork 840
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
Support for STM32 SPDIFRX #3280
Conversation
590c608
to
f4ac473
Compare
f4ac473
to
462f0a4
Compare
This is great! Do you have a basic example of how to use it? |
@kalkyl Yes, I will make one for the STM32H7 + SAI (which can use the SPDIFRX symbol clock), but the SPDIFRX feature is not yet complete. It is missing some sort of left/right detection, otherwise left and right are randomly assigned, depending on what channel the first frame was meant for. |
IIRC it's the "C" bit (channel status) in "DR", 0=left, 1=right? |
20035bd
to
2a8b0d2
Compare
1794e43
to
f09a7fe
Compare
The example will try to synchronize to an S/PDIF source. When it does, it outputs to SAI.
|
9bd2ef9
to
f8d29c6
Compare
Requires: embassy-rs/stm32-data#535 |
4d4f14c
to
62dbe40
Compare
@kalkyl Do you have some chance or hardware for testing this? I verified functionality on my STM32H723, including channel synchronization (left/right). It makes the most sense to test this on:
They connect the SPDIFRX symbol clock to the input of SAI4, so symbol clocks can be synchronized. |
I think i only have the h750 and the h745 from the h7 family right now in the lab... |
Ok, they don't have it, unfortunately. You could dump the samples into SAI regardless, with some glitches when the buffers drift apart. It would be nice to have some symbol clock output (on a pin) and then use it as the external I2S/SAI clock, but I don't think that is possible either. |
Needs #3511 |
62dbe40
to
c7c59bd
Compare
Finally, this seems to be ready for review. |
c7c59bd
to
84f7bff
Compare
bender run (flaky network issue...) |
84f7bff
to
3cece13
Compare
Thanks for working on this! Looks great to me! |
Here is another example of this code in action: https://github.com/blus-audio/firmware-rs/blob/main/blus_mini_mk2/src/main.rs#L298 The data is then consumed here: https://github.com/blus-audio/firmware-rs/blob/main/blus_mini_mk2/src/audio_routing.rs#L323 There is some strangeness happening (output only 16 of 24 bit) due to me playing on four SAI slots. This is due to my hardware configuration. |
I want to do some more improvements to this.. Making it a draft again. |
3cece13
to
577a429
Compare
Should be fine now. I get reliable left/right synchronization. |
Making this a draft again, because playing from SPDIFRX causes some crazy side effects in my testing... |
0650b13
to
ba90e4e
Compare
ba90e4e
to
cb8528a
Compare
bender run |
1 similar comment
bender run |
cb8528a
to
99dd5e7
Compare
bender run |
This adds support for the STM32 SPDIFRX peripheral.
Requires embassy-rs/stm32-data#518