USB Audio framework spdif to i2s issue

If you have a simple question and just want an answer.
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

USB Audio framework spdif to i2s issue

Postby __BriKs__ » Tue Aug 18, 2020 8:51 pm

Hello,

I'm working on a custom HW with a XUF208 256 TQ64 chipset.
I work with the usb audio software framework.
The device is an audio power stereo amplifier with USB and SPDIF IN and a DAC.
The USB streaming works and now I work on the SPDIF IN part.

I don't know how to use usb audio framework to get the spdif working.
My custom HW is designed on xCORE-200 multichannel audio platform with a clock generator CS2100 and PLL PL611 (just like audio plateform hardware).
I use a scope to probe SPDIF signal which looks good, I probe also the signal PLL_SYNC (like in audio plateform hardware) which looks good (300Hz).
I proble DAC signals all looks good (master clock, DAC_BCLK, DAC_LRCLK) except DAC_DATA which is always low level despite there is data on SPDIF line.

My dac and clock sheme works because when using USB the device works correctly.

I suspect a bad configuration in my project files (makefile and customdefine.h).

How can I get SPDIF IN working (only SPDIF, USB disable) ?
Here my project files.

I didn't really well understand how to configure spdif IN ;
Do I need the mixer core ?
How to set this line ? :
/* Channel index of SPDIF Rx channels */
#define SPDIF_RX_INDEX (0)
Do I need NUM_USB_CHAN_IN to specific value ?

My objective is just to stream from spdif to I2s instead of USB to i2s.

Many thanks for help :)

Best Regards,

Florian
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1816
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Tue Aug 18, 2020 8:58 pm

__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Tue Aug 18, 2020 9:05 pm

Hello mon2 hope your are doing well.

This is my plan B in case I can't get initial hw design working which is designed upon Xmos audio plateforme and using a dedicaced chip to regen audio clock from spdif with low jitter.
The AN00231 purpose is to do clock regeneration with cpu without using Xmos audio plateform design.

I think it is just a file configuration error to get working audio usb framework streaming spdif. Then I will focus first on trying to get usb framework working.

Attached my whole project (called BriXamp) and schematic.
You do not have the required permissions to view the files attached to this post.
User avatar
mon2
XCore Legend
Posts: 1816
Joined: Thu Jun 10, 2010 11:43 am

Postby mon2 » Tue Aug 18, 2020 10:02 pm

See if section 3.8 helps:

Code: Select all

https://www.xmos.com/download/sw_usb_audio:-sw_usb_audio-[design-guide](6.16.1alpha1).pdf
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Wed Aug 19, 2020 8:44 pm

Yes I understand I don't need mixer to play sound from SPDIF.

Then I use in makefile the following parameters:
-DI2S_CHAN_DAC=2 -DI2S_CHAN_ADC=0 -DNUM_USB_CHAN_OUT=0 -DNUM_USB_CHAN_IN=0 -DSPDIF_RX=1 -DMIDI=0 -DDSD_CHAN_DAC=0 -DMAX_FREQ=192000
And I get a build error:
C:/Users/Florian Briquel/Desktop/BriXampspdif/module_usb_audio/audio.xc:682:73: error: index of array exceeds its upper bound
asm("ldw %0, dp[g_digData]":"=r"(samplesIn_0[SPDIF_RX_INDEX + 0]));
~~~~~~~~~~~~~~~~^~~~
C:/Users/Florian Briquel/Desktop/BriXampspdif/module_usb_audio/audio.xc:683:75: error: index of array exceeds its upper bound
asm("ldw %0, dp[g_digData+4]":"=r"(samplesIn_0[SPDIF_RX_INDEX + 1]));

I don't understand how to set following line in customdefine.h:
/* Channel index of SPDIF Rx channels */
#define SPDIF_RX_INDEX (???)

I made mistake thinking that spdif rx index set to 0 will put spdif data into audio driver instead of usb data but I realize I don't understand the relationship between spdif_rx_index and samplesIn.
Can anybody help to understand how to play spdif with xmos usb multiplateforme framework ?
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Wed Aug 19, 2020 9:49 pm

Fun facts, project build when I set -DNUM_USB_CHAN_IN to 2 (-DNUM_USB_CHAN_IN=2) and then hw relative to clock seems working:
the cs2100 ic is feeded by a 300hz signal from xmos and xmos set the right pin to select masterclock from cs2100 instead of pl611. In other word the hw designed from xmos audio multichanel plateforme works just as expected. The dac is feeded with bclk, lrclk and masterclock but still nothing on data line. There is data on spdif line which is connected to xmos pin 42 xod35 (single bit port P1L0 juts like defined in my xn file).

I think my hw is good this is the firmware which is not well configured.

I suspect I'm not far away to get it working but it seems no sense to get the project build with the line -DNUM_USB_CHAN_IN=2 because I don't want to push data from xmos to host I just want to push data from spdif to i2s :)
__BriKs__
Active Member
Posts: 39
Joined: Tue Nov 27, 2018 9:45 pm

Postby __BriKs__ » Wed Aug 26, 2020 9:17 pm

Hello,

Finally I'm using the AN00231 SPDIF TO I2S ASRC project to see if my hw is working regards to spdif IN.
I'm in trouble with this project; It almost works but hang.
I modify the project to remove all relative to I2C (my PCM1792 dac don't need any config to work), button and led.
My HW is based upon multichannel audio plateforme (specially in regards of DAC reset and MCLK selection pin).
I get the following output from console when runing the project with toslink connected and my pc streaming music on it:
Starting I2S
SR change in lib_audio_codec - 48000
Initializing I2S to 48000Hz and MCLK to 24576000Hz
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1

a lots of 'New rate in SRC in=3, out=1' lines and:
spdif rate ave=0, valid=0, i2s rate=0, valid=0, i2s_buff=-15, fs_ratio=0x1FFEAC0B, nom_fs=0x20000000
and finally:
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=3, out=1
New rate in SRC in=57005, out=1
ASRC_proc Error code 11
After the line ASRC proc Error the I2S lines come inactive (high level state).

I scope I2S signal, I see looking good signals interrrupted by blank level (high level) on I2S data, bclk and wclk.
I think something is not very well initialized reseting the process all the time (all the 'New rate in SRC in=3, out=1' line)
I share my project, anybody can help me debug ?

Regards,

Florian
You do not have the required permissions to view the files attached to this post.

Who is online

Users browsing this forum: No registered users and 7 guests