S/PDIF IN - multi channel dev board

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

S/PDIF IN - multi channel dev board

Post by yes2i2s »

Hi guys

Can someone please point me in the direction of the code necessary to enable and test the SPDIF input on the multichannel board.

Is it possible to switch between SPDIF in and USB in, to get audio out of the DAC? This is what I am after:

USB > I2S

or

SPDIF > I2S

Selectable by plugging in or unplugging one of the inputs (perhaps enables when SPDIF-in locks?), or by user hardware switch.

The idea is to create a general purpose DAC that accepts either USB or SPDIF as an audio source

Thanks!
Last edited by yes2i2s on Fri Apr 06, 2018 2:51 pm, edited 1 time in total.


yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

I see on the multi channel dev board that the spdif inputs go straight to the proc pins 20 & 21. I don't see any PLL or reclocking in their path. Does this mean they would use the ASRC in order to work? Basically in the schematic / PCB design of this board, how is it intended for you to use the SPDIF input? I could use a TI SPDIF receiver chip, and mux with the XMOS and into my DAC, but this is massively undesirable and I probably won't do it as I have so much already on this board. Having the XMOS switch between USB and SPDIF, then out to the DAC is the perfect general purpose DAC solution.
User avatar
andrewxcav
Active Member
Posts: 62
Joined: Wed Feb 17, 2016 5:10 pm
Contact:

Post by andrewxcav »

All available code should be here:

https://www.xmos.com/jp/support/boards?product=18334

AN00231: SPDIF Receive to I2S output using Asynchronous Sample Rate Conversion [sw] seems to do half of what you want, and the firmware that comes with the board does the other half. I have zero doubt that it would be possible to mux these using a shared buffer and a push-button or switch, however I don't see that on-board firmware, which would make this an easier task!

I will have a look around internally for that and get back to you.
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

Thank you very much. I can see the principles of how this could work, I just need directions / examples on implementing it as I am not a thoroughbred xmos software dev, more of an Altium designer that reworks firmware to suit :)

Would another option be to have these two inputs always 'mixed'. So you would not hear the SPDIF if USB is not plugged in, and you would not hear USB if the SPDIF was plugged in. If however this would destroy the bit perfect representation when only one input is running, it's a no go. Otherwise it could be acceptable.

Thanks!
User avatar
larry
Respected Member
Posts: 275
Joined: Fri Mar 12, 2010 6:03 pm

Post by larry »

With USB plugged in you can select the S/PDIF input as a clock source for the USB Audio device. That way it will come out "bit perfect".

Operation without USB plugged will require some code changes. For example the device will not know what sample rate to configure the I2S bus to. It won't detect sample rate of the S/PDIF stream.
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

Is this achievable with the ASRC? Basically it must have been expected that you'd use the existing clock system on the board, as it was placed on the PCB without any PLL on the SPDIF in.

Can the USB audio and SPDIF (with ASRC) adhere to the MCLK already on the board, be both software mixed on chip, and come out of the DAC? As a static configuration, so DAC always equals USB + SPDIF(ASRC). Or is that asking for the moon on a stick? haha
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

This basically does exactly what is needed, but I am under the impression that it puts USB audio out of the equation.

http://www.xmos.com/jp/download/private ... rc1%29.pdf

If I can do this but not loose USB input capability then I'm rolling, can anyone shed light on it?

The other (less desirable) option is to put a DIR9001 on the board, and physically switch between that and the XMOS, to the DAC. Lots more hardware needed :/
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

I see I am quoting the same app ref you guys already mention, sorry!

So yes I have the USB firmware, and the SPDIF app note, it's just fusing the two somehow.
yes2i2s
Experienced Member
Posts: 73
Joined: Tue Nov 24, 2015 4:06 pm

Post by yes2i2s »

Decided to try this instead, use a DPDT mini switch and a DIR9001 chip with following modes, in case anyone finds this useful:

I will test this tonight with the eval boards for each.

Mode 1:
Ground DIR9001 reset pin
Ground GND pin of xmos PLL to boot it's clocks
Connect RCA socket to XMOS SPDIF out

Mode 2:
Release DIR9001 reset pin
Release GND of XMOS PLL to shut down it's clocks
Connect RCA socket to DIR9001 SPDIF in


DIR9001 and XMOS audio pins share the I2S bus. DIR9001 has it's own PLL and produces all it's own clocks

Thoughts on this approach? Just requires a chip and a switch with a few passives.

It would be nice to put Toslink in that auto selects over coax but need to look at how simple that is.
Post Reply