Need a simple circuit for ADC to SPiDF - Page 1
Forum section: electronics / projects

author: cncjerry
author_rank: Unknown
timestamp: April 18, 2024, 03:50:33 pm
content: Hello all,I am looking for a simple circuit or demo board that has an ADC and SPIDF output. Know of anything? It could exist on a protoboard for now, I am good with STM, Arduino, etc if needed. I figure there might be a two or three chip solution, I have a driver board I built. I need to route audio to two locations over existing coax.I built a Pandora player for my wife on our anniversary today (28yrs). I used scrounged parts, bought a cheap touchscreen display and it works great. She had been using Alexa but it has dropouts occasionally and sometimes Alexa just won't play. I've screwed around with it for weeks and gave up. The player I built uses a Beaglebone black I had, the touchscreeen with HDMI and audio and a high res Burr-Brown USB DAC. Plays perfectly, has remote thru one of the keyboard hand-held devices and I'm happy with it. I was going to install it in one location but then realized it would be better in another to drive two sets of speakers that are today connected with SPIDF over a router/buffer I built. I want to put this on that setup. I should just buy a USB audio device that has SPIDF out, I guess, but it will just add more cost she'll tell me to fix Alexa...of course.ThanksJerry

author: linux-works
author_rank: Super Contributor
timestamp: April 18, 2024, 04:00:16 pm
content: spdif is mostly dead (and I was highly into spdif for many decades).usb audio is the way to go. no downsides and no cable issues.make your life easier. any cheap usb audio dac is fine.

author: moffy
author_rank: Super Contributor
timestamp: April 18, 2024, 04:08:35 pm
content: I was looking for something similar and found this a USB soundcard with ADC/DAC and SPDIF in and out.https://www.ebay.com.au/itm/226035836430?itmmeta=01HVRZAVY445SG3T1SYBF3STJ2&hash=item34a0c9260e:g:QIUAAOSwqNNkJ7zY&itmprp=enc%3AAQAJAAAAwIQopQvyaCI6RBnUhEBnGfg8n9VZW18s%2Fg%2BL8uD1ZYE%2FL6Go0RmyyizeEeXwkvCt1IbtvaOQRu3c6RfGfGYAIJlsCQBtP%2FBvIHvjIN3p5TroP%2Ft4E6k9AwHKoghljY8GigMdZb7iDI%2B2mZO%2FdzabDXfmyxiefO39%2F3%2Bf66hoPXrVcnFeVOBTY43JOOflHm3SwRKTH6U8EHlLSmTLd0QsAgA6qmGqNtgW6lsIr1iOUFczObsUDUryHWJu5rYAmvL5ZQ%3D%3D%7Ctkp%3ABk9SR5S_q5_eYw

author: cncjerry
author_rank: Unknown
timestamp: April 18, 2024, 08:48:20 pm
content: Quote from: moffy on April 18, 2024, 04:08:35 pmThat's a deal. I also found a Wondom device today that I think will do it for even less:https://store.sure-electronics.com/product/609I think this board has a full USB compliant audio interface and outputs SPIDF and toslink as well as audio on a 3.5mm jack.I've used a lot of their products and tested some as well. The interface with SigmaStudio (always get that wrong) by Analog Devices makes them very powerful. You can put noise reduction and dsp based crossovers in powered speakers for cheap. I use their boards with my synthesizers for crossovers to subs.The reason I need SPIDF is that I already have high quality cabling running from a closet to two remote locations. I cant pull USB cables or ethernet up there without a major hassle. I wish I had ethernet in those two locations but I don't. So I am going to put the Pandora box into a closet and run SPIDF over the existing cables using a line driver I built many moons ago. The alternatives are just not practical in my current state of health.I would have thought there was a way to do it using parts I have on hand. I have ADCs, etc, STM and arduino boards, all kinds of stuff. I saw where someone used a parallax propeller but it looked like a purpose-built device.Thanks again.Jerry

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: April 18, 2024, 08:53:30 pm
content: Something like this ?https://www.ebay.co.uk/itm/184443856487

author: moffy
author_rank: Super Contributor
timestamp: April 18, 2024, 11:05:35 pm
content: Quote from: cncjerry on April 18, 2024, 08:48:20 pmIt is hard to justify some DIY when you can buy reasonable products that are cheaper than buying the components let alone the cost and time of making the PCB. Must say that Wondom price is exceptional. Hope your health improves it is a struggle when you aren't well.

author: moffy
author_rank: Super Contributor
timestamp: April 18, 2024, 11:53:17 pm
content: Just an FYI note, usually to utilise the ADC to SPDIF out, it needs to be routed via USB to the PC then sent out again, so you need an active PC/controller to complete the loop.

author: cncjerry
author_rank: Unknown
timestamp: April 19, 2024, 12:30:10 am
content: I was on ebay and yes, there seem to be a lot of devices that mention SPIDF but it seems like a lot of them convert the SPIDF to analog audio DAC vs ADC in my case. The reason I posted is I thought there was a chip that had an integrated ADC to SPIDF to provide that output for stereo receivers. For some reason, I remember seeing analog audio routed to a board with just a few or even one chip and then a driver to SPIDF. I have some old CD players that are junk, maybe I'll pull one apart to see how they did it. Most likely they used I2C or something to a chip. I ordered the Wondom board as I have experience with their products. Thanks for the alternatives.By the way, though older now, the Beaglebone Pandora player using Pianobar really works well. Linux using Alsa audio is very configurable. None of my USB Audio interfaces had SPIDF. I have a Digital Domain SPIDF-toslink converter box that Bob Katz made years ago. I actually spoke with Bob when I ordered it. So I used that to route digital audio around the house 20yrs ago.Jerry

author: moffy
author_rank: Super Contributor
timestamp: April 19, 2024, 01:13:36 am
content: Quote from: mikeselectricstuff on April 18, 2024, 08:53:30 pmThe converter mikeselectricstuff found seems to do the trick, ADC->SPDIF.

author: linux-works
author_rank: Super Contributor
timestamp: April 19, 2024, 02:00:27 pm
content: you can easily carry audio over wifi (and ip) these days.hell, you can effectively run nfs over wifi (I do that and have been for years, now).I would suggest wifi for your longer haul and then go to a rasp pi or something that can do a great job with an ip stack and usb stack and audio. linux is ideal for that.you could even go cheaper. esp32 nodes. and if you like 'bits' you can run i2s into a fancy-ass dac and really be able to bragseriously, wifi and usb audio is the only real thing that's worth considering today. speaking as an spdif and DAT guy from many decades ago (any dat-heads mailing list guys here, anymore?)

author: cncjerry
author_rank: Unknown
timestamp: April 19, 2024, 03:51:17 pm
content: I was on the dat-heads list years ago, cant remember if I was cncjerry then, probably not. I still have my dat walkman and pulled it out because that has an external converter that would do what I want. The player won't load a tape. I think it has something to do with the latch on the lid, getting an error 2 and others. I used dat for everything, had a couple console units, had kicked around getting another because we used the dat walkman music in the delivery room and would like to archive that from when my boys were born. I guess it is archived because we can't play it, isn't that the definition?Yes, wireless is better, but then I would need three of these setups to provide music to the three rooms my wife frequents whereas using my existing cables and distribution setup, I can do it with one $10 device. Also, I would have to figure out how to sync them. I wanted this to be simple because she can barely use a remote control with instructions glue on the back.That device from the UK would work and I think the Wondom audio does the same except the wondom has a ful usb audio stack for $8.I'll report back when it gets here. By the way, this setup sips power compared to a laptop.Jerry

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 19, 2024, 05:11:38 pm
content: Quote from: cncjerry on April 18, 2024, 03:50:33 pmNXP MIMXRT10xx series microcontrollers have S/PDIF inputs and outputs.Teensy 4.0($24) andTeensy 4.1($31.50; +$3.90 for the Ethernet kit, and +$1.80 for 8MByte PSRAM) development boards have S/PDIF input on pin 15 and output on pin 16; and there is a separate CD-quality (16-bit 44.1kHz)Audio adapter board($14.40), albeit without S/PDIF input/output.For S/PDIF input and output, you do need to consider the signal pin voltage (these are limited to 3.3V logic levels). Personally, I'd create a small carrier board in EasyEDA (for easy manufacturing at JLCPCB), containing a TXU0202 level shifter (bandwidth well exceeds all S/PDIF variants), and footprints for through-hole S/PDIF optical cable transmitter (TOTXnnnn) and receiver (TORXnnnn), plus the supply bypass caps and current-limiting resistors they need. Actually, it would be quite easy to add the Audio adapter board functionality (SGTL5000 chip) on it (with line in and line out), avoiding the hassle with pin 15 (S/PDIF in) which is used for volume control potentiometer on the Audio adapter board.Quote from: cncjerry on April 18, 2024, 03:50:33 pmBeagleBone Black uses TI Sitara AM3358, which has Linux support for S/PDIF output via any (I believe) of themcasp("multichannel audio serial port") output pins. You only need one mcasp pin per output; say pin 18, 31, 32, 33, 34, 35, 36, 37, 38 on connector P8; pin 12, 25, 27, 28, 29, 30, 31 on connector P9. Do double-check; not all of those may actually work. I would create a small carrier board for a TXU0102 level shifter and two TOTX173 or compatible transmitters, with the necessary current-limiting resistors and supply bypass capacitors, and suitable mounting holes so the transmitter can poke out of the enclosure. This way, your BBB would acquire one or two additional audio output ports, the two S/PDIF transmitters, with just a change in the Device Tree, and the helper board. If possible, I'd use the P9 connector (same side as the DC jack), so that 3.3V would be picked up from pins 3-4, 5V from pins 5-6, and ground from pins 1-2.While the 3.3V logic level is sufficient for the TOTX173, TOTX1952 etc. optical transmitters, so level translator is not needed from a functional point of view, I am worried that during bootup, when the pin is floating/input (by default), the transmitter might pull or float it above 3.3V, which can easily damage the pin circuitry on the BBB. Thus, the TXU0101/0102 level translator is just a safety thing here, something that I always use to protect the sensitive pins on my SBCs and microcontrollers.

author: cncjerry
author_rank: Unknown
timestamp: April 21, 2024, 11:37:10 pm
content: Nominal, thanks. I have a board coming that does usb audio to analog out with a Burr-brown dac. that will solve all the problems. But If I can get your idea running on the beaglebone native, then I can pull some stuff out of the setup. When I list the audio devices on the beaglebone, I see a couple of mcasp devices. they are listed at i2s as well.sysdefault:CARD=BlackTI BeagleBone Black, davinci-mcasp.0-i2s-hifi i2s-hifi-0Default Audio Devicedmix:CARD=Black,DEV=0TI BeagleBone Black, davinci-mcasp.0-i2s-hifi i2s-hifi-0Direct sample mixing devicedsnoop:CARD=Black,DEV=0TI BeagleBone Black, davinci-mcasp.0-i2s-hifi i2s-hifi-0Direct sample snooping devicehw:CARD=Black,DEV=0TI BeagleBone Black, davinci-mcasp.0-i2s-hifi i2s-hifi-0Direct hardware device without any conversionsplughw:CARD=Black,DEV=0TI BeagleBone Black, davinci-mcasp.0-i2s-hifi i2s-hifi-0Hardware device with all software conversionsI also have the hardware drivers available (electronics). I don't use the optical, just RCA, and have driven that with paralleled buffer ICs in the past. I would have to see if the level shifters are necessary too as the signal would only be going a few feet to a converter/spidf line driver I bought from Bob Katz years ago. That has two RCA and two optical outputs and then I've made my own too.I have to figure out how to get Alsa talking to the mcasp pins. If you have a pointer, that would be cool as I could cut more hardware out. I have Burr-brown and Crystal semi DACs on the ends of the SPIDF links today.I thought the Beaglebone black had more built-in audio. The hdmi display shows up too but I wasn't able to get it to output anything but front center, but that's my issue. This setup as-is sound really good, I got lots of points with my spouse.thanks,jerryby the way, tapeheads is still around. dat-heads has a facebook group too. I pulled out my sony dat, TCD-D7, watched some repair videos, but something is beyond my repair effort right now. I checked all the caps, the grease is fine, it seems to be jammed in the load (threaded) mode, won't unload. If I move the thread arms back, they will stay that way until I load a tape, and then they won't reverse or unload. I repaired my TASCAM BR20 recently, needed a belt, you couldn't even see it in there. That deck has a long history of albums that were mixed down to two tracks on it.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 22, 2024, 04:59:13 pm
content: Quote from: cncjerry on April 21, 2024, 11:37:10 pmThese are defined in the Device Tree; see e.g.this Adafruit PDForthis BeagleBoard blog post.Basically, a device tree is a description of the available hardware, provided to the Linux kernel at bootup. The source (.dts) is human-readable, and is compiled to binary form. Typically, you have one main device tree binary file, plus any number ofoverlays(.dtbo). It looks like your current Device Tree already has amcasp0: { ... }node, so you only need to adjust it, i.e. create a modified overlay.After looking at the documentation, it looks like only P8 pins 31, 32, 33, 34, 35, 36 and P9 pins 25, 27, 28, 30, 41B, 42B can be used as S/PDIF inputs or outputs; and that simultaneous HDMI audio and S/PDIF audio is not possible.I did a quick search for an S/PDIF DT overlay for BBB, but could not find any. I could try writing one myself, but not having a BBB myself, it would be pretty annoying to try to write one "blind"...Quote from: cncjerry on April 21, 2024, 11:37:10 pmI've only used the optical ones, plus misused TOTX173/TORX173 with Toslink plastic cables for other stuff (inverted high-baud rate UART, among other things). It's the electrical isolation that is most useful for me.I would definitely not connect an RCA cable directly to any I/O pin on an SBC. The ground loop issues alone give me the heebie-jeebies.At minimum, I'd use a digital isolator, say ISO7710 (1 channel) or ISO6720 (2 channel, same direction), which can also do 3.3V/5V level translation; those are only about 1€ in singles at Mouser, so definitely not a cost issue. (They also need just two 0.1µF supply bypass capacitors on each side, so they're easy to use.) The transmitter circuitry (optical or RCA) does need power, of course, so you'd also need something like a 5V-to-5V isolated DC-DC converter, bypass capacitors, and a linear regulator to something like 3.3V or whatever your transmitter requires (AIUI it is just 0.6Vpp). RECOM RFM-0505S is a very commonly used isolated converter (for up to 200mA output), but below 20mA load, like many others of its kind, its output voltage can shoot above 10V!Quote from: cncjerry on April 21, 2024, 11:37:10 pmAs soon as you boot with a Device Tree overlay providing the sound interface, ALSA will pick it up.USB S/PDIF cables or dongles are easier to use, because they implement USB Audio (UAC), and therefore use standard Linux USB audio drivers. Using one also provides some protection –– the USB port is much more rugged than GPIO pins –– but I don't think they generally implement electrical isolation.Since 48 kHz 32-bit stereo is only 384 kbytes/second, a simple one or two S/PDIF output dongle will likely use only USB 2.0 Full Speed (12 Mbit/s, about 1000 kbytes/second in one direction), in which case you can isolate the entire dongle/cable using a cheap (~$10) ADuM3160-based USB isolator off eBay; these implement the ADuM3160 datasheet circuit, and only vary by which isolated 5V DC-DC converter they use. I often use these with microcontrollers and usb to serial cables, and they work just fine; I do check the datasheet for the isolator first, though (for maximum load, and that it has no minimum load and output is regulated). If the dongle has other features, it may use USB 2.0 High Speed, and thus require a high-speed isolator, which tend to be much more expensive.

author: MLXXXp
author_rank: Frequent Contributor
timestamp: April 22, 2024, 09:39:41 pm
content: @cncjerry,You keep referring to SPIDF when I think you mean SPDIF. I'm only pointing this out because it may help if you need to do a search for the term.

author: Nominal Animal
author_rank: Super Contributor
timestamp: April 22, 2024, 10:53:20 pm
content: Technically, it is S/PDIF: "Sony/Philips Digital Interface", also known as "IEC 60958 type II".

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 22, 2024, 10:57:24 pm
content: If you want more flexibility, look for "I2S to SPDIF" solutions - you'll find "a lot" of ready-made boards for this. Then you can use whatever ADC board that has an I2S output and connect them. That'll give you more choice.

author: cncjerry
author_rank: Unknown
timestamp: April 23, 2024, 01:51:39 am
content: ok, my spelling is wrong, sorry. I have other boards that use I2S but nothing with USB on the other side. I have some DSP boards that incorporate the ADAU1401 that I connect to a Crystal Semi board using I2S. Here's a question then, I assume the USB audio gets stripped out and sent to the DAC using I2S in my USB audio adapter. I wonder if I can intercept it easily? Standard DACs and if it is just I2S drive to SPDIF, I can yank that output circuit out of an old broken CD player maybe. Now I am starting to sound cheap...Thanks for the extensive post on the device tree. That was very helpful. I looked around after you mentioned it and would have thought someone would have tried it by now, but SPDIF is old and if I didn't have the cables pulled, I would have come up with another idea. It was cool 30yrs ago when we built the house. I will ultimately try to get it working out of the BBB.I have some old CD players, etc, in various junk boxes and I can pull out the the SPDIF (got the spelling right except for the slash) boards. I've done that before. The issue with all this stuff is that it takes so much reading that I often forget what I was working on in the first place. I remember how long it took to come up to speed on the STM32 boards. The beaglebone boards are right up there with them. A number of people use the R-PI with an application called VolumIO and they use I2S output to the DAC and to SPDIF->DAC. I'll search on that app as it was popular on the BBB too. If I get the I2S out of the BBB, with the device tree configured, then the SPDIF output should be easy.I have the wireless working and the BBB boots right into the userid and starts the application, pretty much automatic but my lovely spouse will still not be able to work it. If I can get it down to a headless unit, that drives a DAC, I can skip the wireless adapter and use ethernet, skip the HDMI display and basically just have the BBB and some interface to the DAC. That would be cheap enough to replicate. Right now, I have the BBB, wireless adapter, USB audio, 7" touchscreen with HDMI audio (duplicated audio I don't need) and a remote control sized keyboard.Thanks for all the input. I like when all the hobbies come together - electronics, audio, do some 3D printing for cases, etc!Jerryps: so I found a crystal cs4228a-KS and tested it with SPDIF output and it works, not from the beaglebone but that's a software issue now. I ran it into a Crystal DAC and I have nice clean audio at the ends of three SPDIF coax lines. In the process of digging for a chip, I found my as-new, original box, etc minidisc player. that is a nice little unit. I forgot how hi-tech that package looked what, 30yrs ago? I was hesitant to put a disc in it but it works perfectly. I wish my DAT worked instead. I guess the minidisc will go back on the shelf for another 30yrs.

author: cncjerry
author_rank: Unknown
timestamp: April 24, 2024, 10:09:42 pm
content: To make thing easier, I just need the I2S out of the beaglebone. I have an old Audio Alchemy DAC and the companion DTI that takes I2S input. So I just need to figure out the beaglebone and supposedly it is already setup. I've had this DAC for 30yrs, forgot about it, found it cleaning out the closet where the BBB setup will reside. Still haven't found my missing HP 15c and 11c calculators.Jerry