I2S to SPDIF on XU208 Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
Zed1970
Active Member
Posts: 55
Joined: Tue Oct 15, 2019 10:36 am

I2S to SPDIF on XU208

Post by Zed1970 »

Hi All,

We're designing an embedded XMOS I2S to SPDIF converter to sit being a NXP SoC. We've used the XMOS a number of times for USB to SPDIF audio but this time we'd prefer to use the SoC's SAI I2S port as in input to the XMOS. I see a lot of designs for using I2S as an output to a DAC but nothing using I2S as an input piping the stream to a SPDIF output; is this possible? Any code available?
Out top end rate will be 384K, device XU208 with two TCXOs for the 8/11 rates.

Any tips appreciated!

Cheers.


View Solution
User avatar
Ross
XCore Expert
Posts: 893
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Should be pretty simple if the mclk is shared system wide - just bolt the lib_spdif rx example to lib_i2s! :)

Note, moving this out of USB Audio
Zed1970
Active Member
Posts: 55
Joined: Tue Oct 15, 2019 10:36 am

Post by Zed1970 »

Hi Ross,

Thanks for your reply but we need I2S RX to SPDIF TX. You have reply with SPDIF being the rx which we don't require.

Any other ideas?

Cheers.
User avatar
Ross
XCore Expert
Posts: 893
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Sorry that should have been “tx example”!
User avatar
Ross
XCore Expert
Posts: 893
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Zed1970
Active Member
Posts: 55
Joined: Tue Oct 15, 2019 10:36 am

Post by Zed1970 »

Thanks. Going from I2S in to SPDIF out, is there any conversion issues regarding rate or is it fairly 1:1 (obviously have to toggle the external 8/11 clock appropriately)?
You mentioned 'just bolt it up', I2S has the L/R data transfer and SPDIF has its overheads, those aside, is the audio data in each stream fairly compatible?

Cheers.
User avatar
Ross
XCore Expert
Posts: 893
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

assuming you are keeping the same sample rate, the rate will be the same. I.e. 48kHz in -> 48KHz out.

You will just get sample values out of lib_i2s that you should pass to lib_spdif. lib_spdif will deal with the proper creation of the spdif stream.

BTW, how will the system know what SR to run at? Some other control interface or is the idea that I2S is slave and auto-detects the rate?
Zed1970
Active Member
Posts: 55
Joined: Tue Oct 15, 2019 10:36 am

Post by Zed1970 »

I2S is the master from the iMX host playing the audio; I will hijack a close fitting Linux driver that also has I2C and send the rates via that. Done it before for other CODECs, it's not too bad.
Zed1970
Active Member
Posts: 55
Joined: Tue Oct 15, 2019 10:36 am

Post by Zed1970 »

I've used the same Linux SoC for output I2S rates up to 384K; is there any reason why the XU208 couldn't handle that? The XE216 can do 384K (USB->SPDIF) with a few tweaks; I'm hoping the XU208 and my idea can do the same :)
User avatar
Ross
XCore Expert
Posts: 893
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Zed1970 wrote: Wed May 31, 2023 4:28 pm I2S is the master from the iMX host playing the audio; I will hijack a close fitting Linux driver that also has I2C and send the rates via that. Done it before for other CODECs, it's not too bad.
This should be a pretty straight forward job then I should say. The 'hardest' thing about the sort of projects is normally the clocking and you're managing to avoid most of this with this setup.