XU216-512-TQ128 without DAC's and ADC's problem

XCore Project reviews, ideas, videos and proposals.
mikandrzej
Junior Member
Posts: 7
Joined: Tue Jun 20, 2017 12:57 am

XU216-512-TQ128 without DAC's and ADC's problem

Postby mikandrzej » Tue Jun 20, 2017 1:24 am

Hi.

I have a board with XU216-512-TQ128 and 24,576Mhz and 22,579Mhz oscillators. I want to plug it by usb to PC and play sound (UAC2). Now, when I upload firmware for XMOS Multichannel board, then on windows I can see warning "Windows cannot play the test tone". I want to play sound by multichannel device with 3xI2S output and 1xSPDIF.

I know, that on the board from XMOS there are DAC and ADC. I don't want to use them, because I have my own external DAC.

When I plug DIGITAL LOGIC ANALYSER into the board, I can see, that MCLK, BCLK, LRCLK are generating, but there is no data on outputs.

Thank You.

Mikołaj
User avatar
infiniteimprobability
XCore Expert
Posts: 875
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Tue Jun 20, 2017 8:47 am

HI, what does the debugger say? Where is the code stuck?

Have you modified audio_hw.xc? If not I suspect the code will be stuck trying to talk to non-existent I2C slave devices..
mikandrzej
Junior Member
Posts: 7
Joined: Tue Jun 20, 2017 12:57 am

Postby mikandrzej » Wed Jun 21, 2017 10:24 am

Hi.

First of all, I am building "app_usb_aud_xk_216_mc" - 1i202xxxxxx configuration.

I have two clock generators:
24,576MHz on 8C7
22,579MHz on 8C3
and outputs are connected to 1F

When I click "Test output" in Windows, there is an error "Cannot play test tone". After it i click "PAUSE" on XMOS debugger, and this is Debug tree:

Image

I don't know what should I show You, so please tell me what you want.

I didn't modified audiohw.xc. I think, that I should modify "gpio_access.h" and add my own line:

#define P_GPIO_MCLK_FSEL2 (1 << 3) /* Select frequency on Phaselink clock. 0 = 24.576MHz for 48k, 1 = 22.5792MHz for 44.1k.*/

and modify those lines on audiohw.xc:

if (mClk == MCLK_441)
{
set_gpio(P_GPIO_MCLK_FSEL, 0);
set_gpio(P_GPIO_MCLK_FSEL2, 1);
}
else
{
set_gpio(P_GPIO_MCLK_FSEL, 1); //mClk = MCLK_48
set_gpio(P_GPIO_MCLK_FSEL2, 0);
}


Can you agree with this?

Thank you.
Mikołaj
User avatar
infiniteimprobability
XCore Expert
Posts: 875
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Wed Jun 21, 2017 1:00 pm

I don't think the above is the source of your problem. As per my first post, you are likely trying to access non existent I2C slaves (DAC/ADC).
Try commenting out the:

Code: Select all

DAC_REGWRITE
ADC_REGWRITE


You really need to fully modify both AudioHwInit() and AudioHwConfig() to match your hardware to port this software. If there is only a GPIO to select the clock and no I2C then this is easy... it's mostly deleting stuff!
mikandrzej
Junior Member
Posts: 7
Joined: Tue Jun 20, 2017 12:57 am

Postby mikandrzej » Thu Jun 29, 2017 10:42 pm

Thank You very much.

PCM is working.

I don't know how to enable DSD mode in XMOS.

My config files (only changes):

xk-audio-216-mc.xn :

Code: Select all

            <Port Location="XS1_PORT_1M"  Name="PORT_DSD_DAC0"/>
            <port Location="XS1_PORT_1H"  Name="PORT_DSD_DAC1"/>
            <Port Location="XS1_PORT_1G"  Name="PORT_DSD_CLK"></Port>

            <Port Location="XS1_PORT_1G"  Name="PORT_I2S_LRCLK"/>
            <Port Location="XS1_PORT_1H"  Name="PORT_I2S_BCLK"/>
            <Port Location="XS1_PORT_1M"  Name="PORT_I2S_DAC0"/>


customdefines.h:

Code: Select all

#ifndef NUM_USB_CHAN_OUT
#define NUM_USB_CHAN_OUT   (2)         /* Host to Device */
#endif

/* Number of IS2 chans to DAC..*/
#ifndef I2S_CHANS_DAC
#define I2S_CHANS_DAC      (2)
#endif

/* Number of DSD chans to DAC..*/
#ifndef DSD_CHANS_DAC
#define DSD_CHANS_DAC      (2)
#endif

.......


/* Maximum frequency device runs at */
#ifndef MAX_FREQ
#define MAX_FREQ           (384000)
#endif


And foobar with DSD file:

Image

Image

Image


When I want to play DSD file, on oscilloscope I can see only that the BCLK is about 2,4MHz and no data on output. I see, that XMOS didn't turn into DSD mode, but still is in PCM. Driver is Thesycon trial UAC 2.0.

Can You help me? Thanks!
User avatar
infiniteimprobability
XCore Expert
Posts: 875
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Fri Jun 30, 2017 9:09 am

You have done what is needed to get the firmware to support DSD. My guess is that you are not doing what's needed to get the host to send DSD. That either needs to be:

- Native DSD using the Thesycon driver. Some pointers for that here
- DoP. Any player should be capable. Key thing is to make sure there are no volume controls (either in player or OS) set to less than 100%.
mikandrzej
Junior Member
Posts: 7
Joined: Tue Jun 20, 2017 12:57 am

Postby mikandrzej » Mon Aug 07, 2017 10:14 pm

Hi!

Sorry, for my absence, I had a lot work.

Still I have a problem with DSD.

When I want to play any DSD file, I have a big breaks between DSD data. Here are screnshoots of LogicAnalyzer:

At 0[s] there is DSD preamble.
Image

Here is this zoomed in. After about 80us XMOS turned into DSD mode
Image

After about 420ms, we can see DSD frames sended to DAC on DATA port
Image

But when we zoom in, there is a big pause between DSD frames. I think that this is cause of problems with DSD in my DAC.
Image


Do You have any idea?
I tried to change something in xaudio code, but I don't know the xc language well.

Please help me.

Mikołaj
User avatar
infiniteimprobability
XCore Expert
Posts: 875
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Tue Aug 08, 2017 9:12 am

Are you using DSD native or DoP?
WHat DSD rate are you running there?
If you stream PCM at high rates (equivalent data rate to the DSD you are using) does the audio play without gaps?
mikandrzej
Junior Member
Posts: 7
Joined: Tue Jun 20, 2017 12:57 am

Postby mikandrzej » Tue Aug 08, 2017 3:49 pm

I think that I'm using DSD native.

DSD file is from this site: http://www.2l.no/hires/ (Stereo DSD 64 2.8224Mbit/s). With DSD 128 there is the same problem but pause between frames is shortest.

I can stream PCM's without any problems (including 384kHz).

Do You have any idea?

Regards
User avatar
infiniteimprobability
XCore Expert
Posts: 875
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Wed Aug 09, 2017 2:36 pm

Do You have any idea?


Well I was wondering whether it was buffer underrun. But DSD64 is equivalent to 176.4KHz @ 16b data rate so if it streams OK at 384kHz then that is likely not the issue.

I would be checking the host data using a USB analyser next in your situation. It would be helpful to understand if the data was still being successfully transmitted from the host (ie. being lost in device) or whether your host is not keeping up somehow.

Saying that, buffer underrun in xmos in DSD mode should result in the silence word being output... so what you are seeing is probably not that

Code: Select all

   if(dsdMode == DSD_MODE_DOP)
   {
        underflowWord = 0xFA969600;
    }
    else if(dsdMode == DSD_MODE_NATIVE)
    {
        underflowWord = 0x96969696;
    }


Definitely check to see if the host is sending the right data...

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 6 guests