SPDIF signal to SPI (or I2S) conversion - Page 1
Forum section: electronics / projects

author: Nounours18200
author_rank: Contributor
timestamp: April 30, 2022, 01:44:28 pm
content: Hello,I try to get a solution (from different forums, so you may find a similar message elsewhere) to convert a SPDIF signal (coming from a CD player for example) to SPI (or I2S because I know how to convert I2S to SPI).This is because I would like to use a DAC chip that has not been designed for audio purposes (AD5791 datasheet is here:https://www.analog.com/media/en/technical-documentation/data-sheets/ad5791.pdf) and this chip requires an SPI signal on its input.To date, I have not get any solution: is there a genius that would have an idea ?Thanks

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 30, 2022, 02:02:22 pm
content: There are (or at least used to be) dedicated IC's for converting between S/PDIF and I2S.I've used the LC89091 for this, but don't know if that one still exists.

author: Nounours18200
author_rank: Contributor
timestamp: April 30, 2022, 02:42:30 pm
content: Congratulations : you are the first one to provide the begining of a solution !I have read the datasheet here:https://pdf1.alldatasheet.com/datasheet-pdf/view/766763/ONSEMI/LC89091JA.htmland I have one remark and one question:-Remark: this chip converts SPDIF to I2S: do you know a chip that converts SPDIF to SPI ?? (this would avoid an additional stage to convert I2S to SPI, which will add complexity, risks of errors and jitter).-Question: the datasheet provides a Typical Application circuit that I have attached to this mail. On the right side of the diagram, I have enlighted in red a part that I dont understand, made of "Audio input/output with a DSP feeding it".Why is there a DSP there and is it required ?? is it possible to just get the I2S output and send this I2S signal directly to another stage (in my case this stage will convert I2S to SPI).Thank you

author: moffy
author_rank: Super Contributor
timestamp: April 30, 2022, 02:46:55 pm
content: Saw this little board that seems to convert both ways:https://store.sure-electronics.com/product/AA-AB41133P.S. Uses the WM8804:https://statics.cirrus.com/pubs/proDatasheet/WM8804_v4.5.pdf

author: Doctorandus_P
author_rank: Super Contributor
timestamp: April 30, 2022, 03:36:43 pm
content: I used it only for a very simple application.RS485 -> LC89091 -> TDA1451 -> PGA2311 -> (2x) ULN2003 -> Speakers.I did not even use the I2C interface on it, as by default it just outputs the I2S.My main purpose was a test bench for the PGA2311 which I wanted to use in a bigger project.But to make it a complete project, (also had to test the software for controlling the PGA2311) I finished it into a complete project.I've got a homebrew home automation network with both 24Vdc and RS485 data over CAT5 cable, so only 2 of the 4 wire pairs are used.I put the "coaxial" S/PDIF trough an RS485 transmitter and put that on the 3rd pair of the CAT5 cable.Result is that with that box I made, I can just tap of both power and audio from the CAT5 cable.But it's been 10 years or so ago and I can't recall many details. Last time I checked the box still worked though.

author: SiliconWizard
author_rank: Super Contributor
timestamp: April 30, 2022, 07:35:49 pm
content: The CS8416 is a pretty typical chip for SPDIF -> I2S. Should be reasonably available.

author: Bassman59
author_rank: Super Contributor
timestamp: April 30, 2022, 10:13:46 pm
content: Quote from: Nounours18200 on April 30, 2022, 01:44:28 pmYou can do this in pretty much any FPGA.

author: NiHaoMike
author_rank: Super Contributor
timestamp: April 30, 2022, 10:34:41 pm
content: If you take the LRCLK of I2S and delay it by one BCLK, you basically have the CS line of SPI.Decoding S/PDIF with a FPGA can definitely be done, I recall however that locking onto the signal is more difficult than it might seem at first glance.

author: Nounours18200
author_rank: Contributor
timestamp: May 01, 2022, 02:57:59 pm
content: QuoteTks: it is a ready to use solution, very handy for initial testing.QuoteSo I understand that the 8416 is able to this conversion: I will probably open a dedicated thread on how to do, because the datasheet is not totally clear for me...The CS8416 approach is obviously easier to setup than the one with a FPGA... even if I look for somebody to explain and guide me on how to use an FPGA (see below).QuoteIf you take the LRCLK of I2S and delay it by one BCLK, you basically have the CS line of SPI.QuoteThis is the approach that I have to learn, because I also plan to use a FPGA to implement an audio dogotal filter, prior sending the data to the DAC chip.But I obviously nee soebody to teach me and quite doing the things with me, because I have never play with an FPGA.If an FPGA is able to convert SPDIF to I2S, I am quite sure that it can convert SPDIF to SPI directly ??This would simplify a lot the rest of the project, because I would not have to convert I2S to SPI !

author: Doctorandus_P
author_rank: Super Contributor
timestamp: May 01, 2022, 09:29:49 pm
content: An FPGA is a bit like a microcontroller. It does nothing on it's own, but it needs a program to do anything, but with that program it can do a lot of different things.A big difference between a FPGA and a microcontroller is that in an FPGA, you directly program the hardware. You define how connections between logic gates are made.This also makes some other differences between FPGA's and uC's clear. A microcontroller usually executes one instruction at a time, and executes them sequentially (with loops etc), while in an FPGA a program is not "executed", but laid out in the hardware and the whole program "runs" all the time, continuously, and because of this FPGA's are many time faster then microcontrollers but they also require a quite different skill set and tools.Getting started in FPGA's is not so very easy.Toolchains for FPGA development used to be all proprietary, but these days there are some open source tools that work on some FPGA's.

author: SiliconWizard
author_rank: Super Contributor
timestamp: May 01, 2022, 11:29:57 pm
content: Quote from: Nounours18200 on May 01, 2022, 02:57:59 pmIt seems relatively straightforward.If you want to evaluate it before making your own board (if you intended to do that), there are ready-made boards with the CS8416 that you can easily find on Aliexpress, eBay and wherever. Many of those boards do include a DAC, but you could get rid of the DAC (or leave it) and just get the I2S signals out.

author: BrianHG
author_rank: Super Contributor
timestamp: May 02, 2022, 12:42:59 am
content: Quote from: Nounours18200 on May 01, 2022, 02:57:59 pmWithout prior FPGA experience, I would say expect almost a year of headaches before you get anything working the way you like. And any new changes might become a headache unless you HDL coded for those circumstances.My recommendation would be to go with a 32 bit DSP which contains floating point and I2S in and out ports.You will at least have a C language and reference libraries, including tons of filters and audio processors to work off of.

author: Buriedcode
author_rank: Super Contributor
timestamp: May 02, 2022, 03:54:55 pm
content: Also remember, S/PDIF isn't just a datastream - it provides the clock for DAC. Dedicated IC's use a PLL, and generate the MCLK, LRCLK, and SCLK, but without one you'll have to buffer the incoming samples and either adjust the frame rate slightly, or drop/double samples every so often because your device clock oscillator will be different from the incoming stream.In terms of just handling a serial stream its straightforward, its the timing thats less trivial.

author: Nounours18200
author_rank: Contributor
timestamp: May 05, 2022, 05:40:37 pm
content: QuoteI have strong skills in programming (but none on FPGA), but I have this same feeling ! And there is a lack of tutorials (at least it seems to me)QuoteAny names ??QuoteGood idea ! I need to find one where I can pick the I2S signal out, prior the DAC...QuoteI agree... and I don't know anything about HDL...QuoteThe more I think about my problem, the more I believe that a DSP would be a much simpler approachQuoteDo you have some evaluation board to recommend ? that would work with the "tons of filters,..." that you talk about ?I believe that the DSP is definitely the best approach for me, but I have to find examples and evaluation boards !Your recommandations are welcomeP.S.: I don't receive the notifications of replies, this is the reason for which I reply so lately...