Stripping xCORE-200 multichannel audio software down to S/PDIF receive only Topic is solved

Sub forums for various specialist XMOS applications. e.g. USB audio, motor control and robotics.
Post Reply
mst
Junior Member
Posts: 6
Joined: Wed Mar 13, 2019 9:51 pm

Stripping xCORE-200 multichannel audio software down to S/PDIF receive only

Post by mst »

Hey,

I am working on a custom design which only receives S/PDIF input from different devices and sends them to the USB host.

To get a known working starting point for my software adjustments, I got the xCORE-200 multichannel audio board and started removing things from the app_usb_aud_xk_216_mc app that I don’t need on my design. Specifically, I have:
  1. disabled the ADC (-DI2S_CHANS_ADC=0) and removed the ADC-related ports from the xn file
  2. removed the DAC from the code and xn file (merely disabling it results in compilation errors)
  3. removed the I2S_BCLK from code and xn file
  4. moved I2S_LRCLK to a different GPIO, as removing it from the code seems to screw up the timings
  5. replaced MCLK_IN2 and MCLK_IN with a clock derived from the reference clock
Find attached a zip file with my patches to the original software.

However, I am hitting a roadblock now. The only remaining port I want to get rid of is PORT_PLL_REF. When moving the signal to a different GPIO, I see USB errors from the kernel when the device is plugged in.

I don’t understand why that’s happening. As far as I can tell from the schematic, the PLL_SYNC signal goes into U10 (CS2100-CP), so if I don’t supply a clock, MCLK_XCORE, AUDIO_MCLK and MCLK_SPDIF won’t carry a valid clock. I thought this is okay, because:
  1. MCLK_XCORE goes into MCLK_IN and MCLK_IN2, which I don’t use
  2. AUDIO_MCLK goes into the analog parts, which I don’t use
  3. MCLK_SPDIF goes into SPDIF transmitting, which I don’t use
I tried attaching xgdb, but I’m not sure how to figure out what’s wrong. Here’s its “info threads” output:

Code: Select all

(gdb) inf thr
  8  tile[1] core[4]  0x00046af6 in XUD_TokenRx_Pid ()
  7  tile[1] core[3] (dual issue)  Endpoint0 (c_ep0_out=<value optimized out>, c_ep0_in=<value optimized out>, c_audioControl=2147685634, c_mix_ctl=2147680514, c_clk_ctl=<value optimized out>, 
    c_EANativeTransport_ctrl=<value optimized out>, dfuInterface=524072) at /usr/src/xmos/ws2/module_usb_audio/endpoint0/endpoint0.c:345
  6  tile[1] core[2] (dual issue)  XUD_SetReady_InPtr (ep=<value optimized out>, len=1, addr=<value optimized out>) at /usr/src/xmos/ws2/module_usb_audio/usb_buffer/usb_buffer.xc:732
  5  tile[1] core[1] (dual issue)  decouple (c_mix_out=2147680258) at /usr/src/xmos/ws2/module_usb_audio/usb_buffer/decouple.xc:810
  4  tile[1] core[0]  L0_UY () at /usr/src/xmos/ws2/module_spdif_rx/src/SpdifReceive.S:1636
  3  tile[0] core[2] (dual issue)  mixer1 (c_host=2147614722, c_mix_ctl=2147614978, c_mixer2=2147616258) at /usr/src/xmos/ws2/module_usb_audio/mixer/mixer.xc:363
  2  tile[0] core[1]  waitQuarter () at /usr/src/xmos/ws2/module_i2c_single_port/src/i2c-sp.xc:29
* 1  tile[0] core[0] (dual issue)  clockGen (c_spdif_rx=2147615234, c_adat_rx=1414165324, p=66560, c_dig_rx=2147617026, c_clk_int=297504931, c_clk_ctl=2749171899)
    at /usr/src/xmos/ws2/module_usb_audio/clocking/clockgen.xc:822
What am I missing?
Thankful for any hints,
Attachments
strip.zip
(13.4 KiB) Downloaded 132 times
strip.zip
(13.4 KiB) Downloaded 132 times


View Solution
mst
Junior Member
Posts: 6
Joined: Wed Mar 13, 2019 9:51 pm

Post by mst »

Figured it out: the code was waiting indefinitely for the PLL to lock, which of course it wouldn’t when moving PLL_SYNC to a different GPIO. The fix is to disable the check:

Code: Select all

--- i/app_usb_aud_xk_216_mc/src/extensions/audiohw.xc
+++ w/app_usb_aud_xk_216_mc/src/extensions/audiohw.xc
@@ -174,7 +174,7 @@ void AudioHwConfig(unsigned samFreq, unsigned mClk, chanend ?c_codec, unsigned d
     }
 
 #if defined(USE_FRACTIONAL_N)
-    while(1)
+    while(0)
     {
         /* Read Unlock Indicator in PLL as sanity check... */
         CS2100_REGREAD(CS2100_DEVICE_CONTROL, data);

Post Reply