Rpi-4 spdif output gpio pin,,?

does the rpi-4 have spdif output gpio pin…??

S/PDIF typically uses an optical connection, whethers the PINs on the Pi are copper. They are fundamentally not compatible, even if you could write up a custom driver for audio out in such a way.

You can get something like the HiFi Berry Digi+ Pro HAT to add a S/PDIF Optical Out to your Pi. Alternatively, any standard USB DAC with S/PDIF Optical Out should work fine.

1 Like

ok well on other sbcs i own there is an gpio pin that is labeled spdif out all i do is wire an optical transmitter to it there a 3 pin device..so it looks like ill have to go with an home made spi interface i seen them but a spdif out is just more simple…you can wire either coax or an optic led to them and they work fine…

i run ubuntu and in the sound preferences it finds on ,weather it is populated to a gpio pin or needs to be added to the kernel to designate it im not shure…but generally if the software finds one it must be there…
it may well be that it is misreported in the sound settings and it is actually the hdmi output…but if you select the multi channell out put i get sound via hdmi without selecting the optical in the sound settings…food for thought…

EDIT: seems i was incorrect it has listed digital output(iec958) output…could somebody pls enlighten me is this via the hdmi…??

I see, I thought you were attempting to directly connect a speaker system to the GPIO pins. If you’re going to be using an optical transmitter to convert the signal on the fly then it should be possible to use one of the digital pins to output a PCM signal. Writing up driver/script for that is outside my expertise (and making it communicate to he operating system even further), though there should be a phython tutorial on this site that could show you what to do. You could use a variety of pins for this, the Pi is very flexible in that regard. You shouldn’t need to build a custom kernel for this, but I’m not sure as I haven’t looked too deeply into the capabilities of the raspberry pi libraries.

Also, optical vs. copper is just the medium to transfer a signal. Both support PCM (direct, uncompressed audio) and bitstream (compressed audio, like Dolby digital, atmos, etc.) fine, as long as the device receiving it supports that input.

If you want to get really hardcore you could solder some copper wires directly onto the traces on the board for the HDMI output and connect that to your transmitter. Very difficult to do however, and you need to know which HDMI wires carry the audio signal, but once done software side it would be as simple as selecting HDMI as your audio output.

In short, a HAT/USB DAC is the easiest option, using a transmitter from the GPIO pins is possible but would require tinkering, direct soldering to HDMI is the most difficult.

1 Like

i do have hdmi audio extractors and my screen has optical ot… i think the need for a better receiver unit is more on the cards…thanks for your intel though …quite an interesting read and i hope this thread will grow and be prosperous for others… a simple task that rpi manufactures could have fitted a pin for the enthusiast…although it is a marketing age these days…thx…

ive often found the more complex the circuit the easier it will fail.

.oh and when i select the digital audio preference in the sound manager the output description says “spdif” “audio” in the lower part of that window…so still leaves me wondering…

1 Like

Hi Brian,

Have a look at this blog post on why the i2s connection via GPIO is usable, but not great

I agree with Ryan here, HDMI or USB audio would be the easiest as long as you ensure linux compatibility