SPDIF In/Out?

Curious if anyone has figured out how to do SPDIF In/Out with the Daisy Seed? I see that the STM32H750 supports SPDIF, and saw a few people asking about it on the forum in 2020, but there was no concrete information on how to do it.

I found many references to RECEIVING SPDIF on STM32 - but nothing on how to send it, though that doesn’t mean it can’t be done. It would be cool to chain Seeds together without doing extra digital/analog conversions.

SAI documents make it seem very possible.

Yeah, I saw that too. I also saw someone using the WM8804 chip with a Raspberry Pi for SPDIF in/out. Raspberry Pi TOSLINK transceiver hat | Hackaday.io That might be another option, but if the Daisy chip supports it out of the box, I’d rather not add more hardware.

If the goal is a Daisy-Daisy connection over short distance, I don’t think hardware is necessary.

It would be daisy to daisy primarily, but I was hoping to keep it flexible enough that I could connect to other SPDIF devices if I wanted to route signal that way. What are you thinking for daisy to daisy connection that isn’t SPDIF?

I was thinking you could maybe connect them SAI to SAI using I2S. IIRC Daisy uses SAI_1 for the CODEC, so SAI_2 would be available for this.

It’s probably non-trivial, but seems like a cool idea.

Interesting, could work, but not as flexible. I’d love to also be able to do things like go from my daisy guitar pedal direct into to the SPDIF on my computer interface too. That’s why I was looking at some sort of standard digital interface, not going custom with SAI or 12S.

1 Like

Starting to think about this again as I redesign my Pedal hardware. Reading this document makes it seem like it’s totally possible to transmit digital audio between two Daisy seeds using SAI2:

https://www.st.com/content/ccc/resource/training/technical/product_training/group0/d3/c0/b0/0e/fe/eb/40/a9/STM32H7-Peripheral-Serial-Audio-Interface_SAI/files/STM32H7-Peripheral-Serial-Audio-Interface_SAI.pdf/_jcr_content/translations/en.STM32H7-Peripheral-Serial-Audio-Interface_SAI.pdf

That article also mentions it’s possible to send S/PDIF via SAI2 on the STM32H7 series. So that’s cool! However, SAI2 can only be used to send S/PDIF, not receive it seems.

After further digging, it does seem like the STM32H7 can receive and decode S/PDIF natively, through different pins according to this document:

https://www.st.com/content/ccc/resource/training/technical/product_training/group0/9c/27/1b/db/aa/d8/48/c3/STM32H7-Peripheral-SonyPhilips_Digital_Interface_Receiver_SPDIF-RX/files/STM32H7-Peripheral-SonyPhilips_Digital_Interface_Receiver_SPDIF-RX.pdf/_jcr_content/translations/en.STM32H7-Peripheral-SonyPhilips_Digital_Interface_Receiver_SPDIF-RX.pdf

No idea, if those pins are exposed on the seed though.

It also appears it would be much more trivial to send Digital Audio In/Out over SAI using the I2S protocol. Seems pretty common to use short RJ45 connectors to do so (though no one seems to agree on the pin out for I2S over RJ45). Ideal connection length seems to be 5-30cm, which would be fine for guitar pedal connections. This might be the simplest way to do this in a small form factor instead of S/PDIF.

By “short” do you mean less than eight pins, like 4 or maybe 6? I’m not arguing with your terminology, I just want to confirm my understanding.

sorry, I meant short length cables. 5-30cm is the recommendation for the length of the cables.

Ahhh, in that case, I’m glad I asked! Thanks @kshep

Continuing my investigation.

I guess what I didn’t realize is that SAI isn’t a specific protocol. It stands for Serial Audio Interface and it’s basically a special part of the STM32h7xx processor that can be used to transmit / receive audio via various protocols including I2S, TDM, PCM, SPDIF (only for output), AC '97 etc.

It seems I2S is most commonly used for IC to IC digital audio communication within a single PCB. It’s not really meant for transmission of digital data between different devices, though it seems like it is possible, as long as the cable distance is short, as I mentioned above. Though this isn’t really a supported part of the standard, which is why there are so many different plugs and wiring strategies to do so. So that sounds less than ideal, and brings me back to my original desire to do S/PDIF communication between devices, since that is more what that is designed for.

Unfortunately, it doesn’t look like the LibDaisy SAI implementation supports all of these protocols. In fact, it currently only supports I2S (probably since that’s what is used on the Seed for the STM32 chip to talk to the external audio codec chip for the audio input / output). It does however appear that the underlying stm32h7xx_hal_sai driver that LibDaisy uses does support them all. I wonder how much effort it would take to modify the LibDaisy SAI implementation to expose the SPDIF functionality…