XK-EVK-XU316: how to make DoP playback work? Topic is solved

Discussions about USB Audio on XMOS devices
User avatar
Harold Barrel
Member++
Posts: 20
Joined: Tue Apr 23, 2024 9:05 am

XK-EVK-XU316: how to make DoP playback work?

Post by Harold Barrel »

Hi all, I've been really struggling to enable DoP playback on the XK-EVK-XU316.
This is what I tried:

1. I started from a clean version of the latest sw_usb_audio (https://github.com/xmos/sw_usb_audio/re ... _8.0.0.zip). This compiles and works fine.
2. I enabled DoP playback by adding the following lines in src/core/xua_defs.h:

Code: Select all

#define NATIVE_DSD         (0)  /* Support only DoP */
#define DSD_CHANS_DAC      (2)  /* Stereo output */
#define PORT_DSD_DAC0      PORT_I2S_DAC_DATA
#define PORT_DSD_DAC1      PORT_I2S_ADC_DATA
#define PORT_DSD_CLK       PORT_I2S_BCLK
3. I ran the resulting executable with xscope attached
4. When I play some DoP, the XMOS crashes with this error:

Code: Select all

xrun: Program received signal ET_ILLEGAL_RESOURCE, Resource exception.
      [Switching to tile[1] core[0] (dual issue)]
      ConfigAudioPorts (p_i2s_dac=@0x82af8, numPortsDac=2, p_i2s_adc=@0x82b70, numPortsAdc=1, divide=8, clk_audio_bclk=774, p_mclk_in=66304, p_bclk=66304, p_lrclk=0, curSamFreq=<value optimized out>) at /home/michele/Projects/DWE-GIT/G26/sw_usb_audio_8.0.0/lib_
      xua/lib_xua/src/core/ports/audioports.xc:39
      39                asm volatile ("setc res[%0], %1" :: "r" (p_lrclk), "r" (0x200006));
I have also tried other single-bit ports for PORT_DSD_DAC0, PORT_DSD_DAC1 and PORT_DSD_CLK, but I always get the same error.
The error looks like I'm accessing a port from another tile, but I don't see how this can be the case: the same ports are used successfully for regular I2S.
Also p_lrclk=0 looks suspicious but I don't see to fix that.

Please share any thoughts on this, I'll be very grateful...
Last edited by Harold Barrel on Thu May 23, 2024 10:12 am, edited 1 time in total.
View Solution
User avatar
Ross
Verified
XCore Expert
Posts: 985
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

This looks like a bug introduced when increasing performance for xcore.ai

this line https://github.com/xmos/lib_xua/blob/f4 ... rts.xc#L39

Should be guarded by

Code: Select all

if(!isnull(p_lrclk))
User avatar
Ross
Verified
XCore Expert
Posts: 985
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

User avatar
Harold Barrel
Member++
Posts: 20
Joined: Tue Apr 23, 2024 9:05 am

Post by Harold Barrel »

Ross wrote: Wed May 22, 2024 12:41 pm This looks like a bug introduced when increasing performance for xcore.ai

this line https://github.com/xmos/lib_xua/blob/f4 ... rts.xc#L39

Should be guarded by

Code: Select all

if(!isnull(p_lrclk))
Hello Ross, thanks for the fix! Now it doesn't crash anymore and I'm able to switch to DoP!
But there's something I don't understand: why is a stereo DoP stream outputted through 2 pins? Why can't it just go through 1 pin with LRCLK active?
User avatar
Ross
Verified
XCore Expert
Posts: 985
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

DSD is single-wire PDM per channel
User avatar
Harold Barrel
Member++
Posts: 20
Joined: Tue Apr 23, 2024 9:05 am

Post by Harold Barrel »

Understood. Thanks again for the support.