Custom Design XU316-1024-QF60B

Discussions about USB Audio on XMOS devices
occipe
New User
Posts: 2
Joined: Mon Aug 26, 2024 12:24 pm

Custom Design XU316-1024-QF60B

Post by occipe »

Hello,

I've built a custom board with xu316-1024-qf60b, self powered, 2 audio Clocks 24Mhz and 22Mhz (enables by 2 gpios) and an SPI flash (old 25p40)

Working under sw usb audio 7.2.0 sdk:

Dfu
I2S ouput ( Async master mode)
JTAG without xlink

In linux Ive tested in master mode, input and output should work with no device( slave) connected :

i2S on tile 0 and xud on tile 1
Speaker-test is working well in output mode
I'm unable to get I2S input working (while i2S output is OK) arecord test is stalled.

What could explain the different behaviour between I2S input and output ?

Thanks
User avatar
Ross
Verified
XCore Legend
Posts: 1119
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Mod edit: moved to USB Audio
Technical Director @ XMOS. Opinions expressed are my own
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1143
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

What could explain the different behaviour between I2S input and output ?
We have to distinguish between the I2S data in/out and the clock roles of I2S. I2S data pins will always have the same job - they will drive I2S data regardless of clock role.

The clock role is different from the data - When XMOS is master (

Code: Select all

CODEC_MASTER=0
), it drives LRCLK and BCLK. When slave (

Code: Select all

CODEC_MASTER=1
) it receives LRCLK and BCLK from and external master. Our examples in sw_usb_audio normally setup the CODEC (DAC/ADC) to own the master clock if

Code: Select all

CODEC_MASTER=1
, but in a custom design you will need to ensure that the I2S LRCLK and BCLK are driven from your hardware in that mode.

If the external I2S master isn't driving then audio hub in sw_usb_audio won't loop and you'll get the problem you are seeing - no audio data/clocks are being pushed so it won't record or play properly. Also note that MCLK needs to be supplied too - we use that to calculate the feedback for the host as part of Asynch mode (where the device owns the audio clock).
Engineer at XMOS
occipe
New User
Posts: 2
Joined: Mon Aug 26, 2024 12:24 pm

Post by occipe »

Hi
Thanks for taking time to reply.
From my understanding when codec master=1 :
I'm providing the mclk
Xmos chip will provide bclk +lrclk
With oscilloscope I'm seeing clock on defined pin (bclk + lrclk) and data (dac mode)

When switching to adc mode
I should see the same clock signals ( from xmos to device)
Am i right?
Thanks
Stephane
User avatar
infiniteimprobability
Verified
XCore Legend
Posts: 1143
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

From my understanding when codec master=1 :
I'm providing the mclk
Xmos chip will provide bclk +lrclk
No - CODEC_MASTER=1 is as saying XMOS is the I2S slave.
So the xcore will expect to see LRCLK/BCLK driven from the DAC/ADC when CODEC_MASTER=1

In our latest ref designs in the XU316 MC board we still provide the MCLK to the DAC/ADC even for CODEC_MASTER=1. However this can be disabled if you want your own local clock source.

If setting CODEC_MASTER=0 (default) then xmos drives all clocks (although you can still have a external MCLK input if you wish but you need to disable the xmos PLL driving it).
Engineer at XMOS