USB aud L1 ref design: Can XS1 chip be used as I2S SLAVE??

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
xcoreuser
Junior Member
Posts: 7
Joined: Mon Sep 10, 2012 10:11 pm

USB aud L1 ref design: Can XS1 chip be used as I2S SLAVE??

Post by xcoreuser »

Hello,

we are trying to use the XS1 chip on the USB audio L1 evaluation board as an I2S *SLAVE* on the audio interface.

The board contains the XS1 chip, acting as a master, connected to a Cirrus CS4270 Codec chip acting as an I2S slave.
According to the CS4270 datasheet, the Codec can be used in stand-alone *MASTER* mode by using a 47kohm pull-up resistor on its SDOUT pin. On the other hand, from the XMOS USB Audio Software Design Guide, we read that we can turn the XS1 reference design into slave mode by commenting out the "#define CODEC_SLAVE 1" line in the "customdefines.h" file. (The guide also says that the build with this option was verified, but only for the L2 reference design.)

So, we tried to change the Codec mode by detaching resistor R34 (pull down on SDOUT pin) from the evaluation board and replacing it with a 47kohm pull-up resistor. We also recompiled the reference design commenting out "#define CODEC_SLAVE 1". As a result, the I2S clock signals "p_bclk" and "p_lrclk", to be controlled by the I2S master, are not generated by the XS1 anymore. Unfortunately, they are not generated by the Codec either, or at least the signals appear to stick at zero. Furthermore, the USB board is not recognized by the host PC anymore.

We also detached the whole Codec chip, and drove the master clock and "p_bclk" and "p_lrclk" signals from an external audio source that implements a supposedly working I2S interface. As usual, the reference design was compiled commenting out the "#define CODEC_SLAVE 1" line. With this setup, the board was (sometimes) recognized by the PC, but no audio input stream was received, at least as seen by the PC.

Notice that the second attempt (external master I2S audio source) corresponds to the final setup we want to build.

We suspect there may be some problems with using the XS1 core as an I2S slave (which is what we need to do) or something wrong with the configuration of the pins in the I2S interface, e.g. in/out direction. Any clue?

Many thanks


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

Post by Ross »

Hello,

As you mentioned, XCore slave mode was only tested on L2. This is because it cannot be supported on the L1 board without hardware modification - since the CODEC is configured in HW mode.

Recently we found an issue with the L1 implementation. This will be addressed in the next software release. However, in the meantime you can fix it in audioports.xc as follows such that it looks like the following:

Code: Select all

#else
 /* Stop bit and master clock blocks and clear port buffers */
 stop_clock(clk_audio_bclk);
 stop_clock(clk_audio_mclk);

 /* Clock bclk clock-block from bclk pin */
 configure_clock_src(clk_audio_bclk, p_bclk);
 configure_clock_src(clk_audio_mclk, p_mclk); /* NEW */


 /* Clock I2S output data ports from b-clock clock block */
 for(int i = 0; i < I2S_WIRES_DAC; i++)
   {
     configure_out_port_no_ready(p_i2s_dac[i], clk_audio_bclk, 0);
   }

 /* Clock I2S input data ports from clock block */
 for(int i = 0; i < I2S_WIRES_ADC; i++)
   {
     configure_in_port_no_ready(p_i2s_adc[i], clk_audio_bclk);
   }

 configure_in_port_no_ready(p_lrclk, clk_audio_bclk);

 start_clock(clk_audio_bclk);
 start_clock(clk_audio_mclk); /* NEW */
#endif
}
Changes are the addition of two lines; the calls to configure_clock_src() and start_clock()
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Post by bearcat »

I can verify the L1 works fine in slave mode I2S, in general (custom board).
xcoreuser
Junior Member
Posts: 7
Joined: Mon Sep 10, 2012 10:11 pm

Post by xcoreuser »

@Ross: Thank you very much for you reply. We will repeat our experiment with a pull-up resistor on the Codec SDOUT pin and your modified code on the XS1, and let you know soon.

@Bearcat: thank you for your post. Did you use the USB L1 audio reference design software or your own code on your custom board?

Many thanks!
bearcat
Respected Member
Posts: 283
Joined: Fri Mar 19, 2010 4:49 am

Post by bearcat »

My firmware is highly customized from the XMOS reference. My design does not use an mclk to the L1, nor the clock block for it.

Good luck with your design.