216 MC - default spdif to I2s extended/

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
User avatar
xlordofpainx
Experienced Member
Posts: 78
Joined: Thu Mar 08, 2018 2:44 pm

216 MC - default spdif to I2s extended/

Post by xlordofpainx »

So I am currently done with most tutorials available for programming, but the audio how-tos are very hard to follow even though I do understand the individual functions. I am looking forward to extending the default SPdif to I2s to also use USB to I2s , while I dont need the DAC function. ( all the I2s information will be transported to another chip where processing will be done).
My question is does anyone have a more basic program related to these? As the one provided by XMOS is made to be efficient but is above my level. Also could you give me some advice as to how I can improve my skills- I done with the basic How-tos provided by XMOS, but what I have found further as examples is a above my level.(not looking for an easy way out)


User avatar
xlordofpainx
Experienced Member
Posts: 78
Joined: Thu Mar 08, 2018 2:44 pm

Post by xlordofpainx »

I am trying to start easy by just implementing the SRC library and the SPDIF library, but compared to what example there is for SPDIF to I2S i cant really see how I can implement this. If someone has a basic program of this would be great.
alexjaw
Active Member
Posts: 35
Joined: Wed Jan 24, 2018 9:13 am

Post by alexjaw »

...the learning curve is pretty steep and the gap is pretty wide between the tutorials and app_usb. That said, as mon2, take some time to digest "USB Audio Design Guide", i.e. the first link. After some reading you will eventually get to chapter 5.7 - Adding Custom Code. It's not really what you are asking for, but it lets you play with the framework and hopefully provides confidence to develop the app you want.
User avatar
xlordofpainx
Experienced Member
Posts: 78
Joined: Thu Mar 08, 2018 2:44 pm

Post by xlordofpainx »

Thank you guys, appreciate the support. It is more or less what i am doing right now- just reading manuals and writing stuff down.I am slowly starting to get a feeling for it (hahaha).
A lot of my progress is due to mon2 :D and reading other people's posts. I will keep marching on this path.
User avatar
infiniteimprobability
XCore Legend
Posts: 1124
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Hi, SPdif to I2s is an interesting one because of teh clocking. The clock is encoded in the SPDIF stream however the local I2S needs MCLK to generate the BCLK and LRCLK (and MCLK is probably needed for a DAC if you wish to have analog out). This requires that the clock be recovered and then multiplied up to MCLK, which needs a PLL normally. We used the CS2100/2300 which can handle as low as 150Hz ref up to 24.576MHz. The Ref can be generated by toggling an I/O after so many samples received. You will need to know what the sample rate is so the PLL ratio can be changed (if you need constant MCLK).

I have some old code for an SPDIF to I2S Appnote which never got published which is attached below. I have not tried this for years bit I think it did work, although it is ported to an obsolete dev kit. It's far from efficient (you could do it all in 3 tasks) but hopefully gives you a flavour. I won't be able to offer support on this but hopefully the code and diagram help. Please be aware that the SPDIF rx lib is only happy up to 96kHz.


Image
You do not have the required permissions to view the files attached to this post.
User avatar
xlordofpainx
Experienced Member
Posts: 78
Joined: Thu Mar 08, 2018 2:44 pm

Post by xlordofpainx »

Thanks infinite, looking at multiple codes, does make it easier for me to comprehend. I have started experimenting with separate functions, still getting my head around things as I was focusing on other sides of my project until recently.

The way my project should work is receiving digital music, converting to 192 and sending this data via I2S to another device which does processing,filtering. The second device+output stage are ready to go, I just have to implement the right XMOS functions into and send the I2S data to the next stage. Nothing too much for the XMOS I guess, Efficiency in this case doesn't matter (to me) as long as it is doing what I want it to do.

After reading some other posts about 192 i see that other people have also attempted this, but no one has posted a definite answer.