Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSD mode not detected correctly in AudioHwConfig() #223

Closed
michele-perrone opened this issue Apr 29, 2024 · 1 comment
Closed

DSD mode not detected correctly in AudioHwConfig() #223

michele-perrone opened this issue Apr 29, 2024 · 1 comment

Comments

@michele-perrone
Copy link

michele-perrone commented Apr 29, 2024

Hi all! I'm using an XK-EVK-XU316 board and I enabled DSD playback. In xua_defs.h, I defined all that was necessary:

/* DSD defines for lib_xua */
#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_MCLK_IN

#define I2S_CHANS_ADC      (0)

Code compiles fine and Audirvana Studio detects the DSD64 DoP capability.

After getting some help on the forum, I was able to access the 4 LEDs from inside void AudioHwConfig(), and I'm toggling LEDs 1-3 based on the PCM sampling rate. Next thing I needed to do was toggling LED 0 based on DSD or PCM playback, so I added this switch-case at the top of the function (I took out the code which switches on/off the LEDs because that's not relevant here):

void AudioHwConfig(unsigned samFreq, unsigned mClk, unsigned dsdMode,
    unsigned sampRes_DAC, unsigned sampRes_ADC)
{
    assert(samFreq >= 22050);

    // Turn on/off LED 0 according to dsdMode
    switch(dsdMode) {
        case DSD_MODE_OFF:
            // Turn LED 0 on
            break;
        case DSD_MODE_NATIVE:
            // LED 0 off
            break;
        case DSD_MODE_DOP:
            // LED 0 off
            break;
        default:
            break;
    }

I'm able to play DSF files at DSD64/128 with Audirvana and Foobar2000 using DoP 1.0, but LED 0 doesn't turn off when I do so. It's always on, which means that the argument unsigned dsdMode must be wrong somehow.

Any ideas on this?

Many thanks,
Michele

@michele-perrone michele-perrone changed the title DSD mode not detected correctly in void AudioHwConfig() DSD mode not detected correctly in AudioHwConfig() Apr 30, 2024
@michele-perrone
Copy link
Author

Okay, after further investigation it looks the problem isn't what it seemed. The XMOS detects the flags correctly, however it crashes when trying to switch to DoP mode:

xrun: Program received signal ET_ILLEGAL_RESOURCE, Resource exception.
      [Switching to tile[1] core[0] (dual issue)]
      ConfigAudioPorts (p_i2s_dac=@0x840a0, numPortsDac=2, p_lrclk=0, p_bclk=66304, divide=8, clk_audio_bclk=774, p_mclk_in=2097158, curSamFreq=<value optimized out>) at /home/michele/Projects/DWE-GIT/G26/xmos/lib_xua/lib_xua/src/core/ports/audioports.xc:39

      39                asm volatile ("setc res[%0], %1" :: "r" (p_lrclk), "r" (0x200006));

So I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant