DOP DSD64 over SpDif

XCore Project reviews, ideas, videos and proposals.
mmar
Experienced Member
Posts: 98
Joined: Fri Jul 05, 2013 5:55 pm

DOP DSD64 over SpDif

Post by mmar »

Based on http://www.xcore.com/projects/dsd-dop-over-spdif-rx

i open forum question as i write to project comment.
Have issue with SpdifReceive.S code .
It decode failure frame bits.

See image comment.
Waveform48_issue.PNG
You do not have the required permissions to view the files attached to this post.


User avatar
Ross
XCore Expert
Posts: 783
Joined: Thu Dec 10, 2009 9:20 pm

Post by Ross »

Hello,

Sorry I cannot understand the issue or the project description. Also, the source code zip is actually just a PNG file. Please upload your source code if you would like assistance.
mmar
Experienced Member
Posts: 98
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Ok Ross i add code parts to project.

DSP thread code work with spdif rx as first in function static void getSamplesFromHost(streaming chanend c).
This is send to audio and scoped as on image.

In test wav file we have samples repeat, but on scope is errors.
mmar
Experienced Member
Posts: 98
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Sorry i have mistake in wav , we mix hex and dec
decode work ok, but pcm is jittered and not playable.

PS: Code is downloadable from project page.
mmar
Experienced Member
Posts: 98
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

This SpdifReceive have requirments for 80Mips thread.

I plan make dualboot xs mode,
one for usb audio and second for spdif.

How this i can compile or better question is how this write to main?

All audio and Spdif use 7 threads, that is out of 80 on 500Mips L1.
User avatar
Ross
XCore Expert
Posts: 783
Joined: Thu Dec 10, 2009 9:20 pm

Post by Ross »

This is probably worth its own thread, but this example should help you out:

https://github.com/xcore/sw_flash_multiboot_example

Basically create your two applications, and use a boot-loader in flash to decide which image to boot (based on a input such as a switch)
mmar
Experienced Member
Posts: 98
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Thanks Ross,
i plan this boot as last resort. Now i try inbuild endpoint and spdifrx into one core,
and set usb pin to reset when rx is in progress. Next core buffer i suspend to wait event.
This for spdif makes only 5 cores active on time.each 100 MHz i mean.

I need help with method for detection of spdif samplerate actual and changes.
User avatar
Ross
XCore Expert
Posts: 783
Joined: Thu Dec 10, 2009 9:20 pm

Post by Ross »

mmar wrote: I need help with method for detection of spdif samplerate actual and changes.
You can just count samples in a given period?
mmar
Experienced Member
Posts: 98
Joined: Fri Jul 05, 2013 5:55 pm

Post by mmar »

Yeap as simple, yes i try count or timer this.

Second query is for starting of spdif mode. I plan detect on spdif_rx port 1 bit with buffering 4.
But this port is assigned to core spdifreceive, and if i need in other thread this pin , compiler say no no no...

Is any choice to do this in xc, or i need use asm and some as PEEK port?

In detection thread i only detect full zero / full one / spdif signal by this code now:
case p_spdif_rx when pinsneq(0) :> eventb:

tdfu=500000;temp=0;
while(tdfu--) {p_spdif_rx :> eventb;
temp+=eventb;}

if(temp==500000) // power off signal full one
{
rstUSB(); // off driver usb

p_spdif_rx when pinsneq(1) :> eventb;

device_reboot();
}

...... for detect not full zero or one switch to spdif mode over chan to thread xx?
break;
User avatar
Ross
XCore Expert
Posts: 783
Joined: Thu Dec 10, 2009 9:20 pm

Post by Ross »

This doesn't sound like a good approach. Why not check for valid S/PDIF samples from the S/PDIF Rx thread of over the channel - you can check the parity, something like:

Code: Select all

while(1)
{
    /* Receive sample from S/PDIF RX thread (steaming chan) */
    c_spdif_rx :> tmp:
                
    /* Check parity and ignore if bad */
    if(badParity(tmp))
       continue;
    else
    {
        /* Valid S/PDIF sample received.. handle it..*/
    }
where badParity() looks something like:

Code: Select all

static inline int badParity(unsigned x)
{
    unsigned X = (x>>4);
    crc32(X, 0, 1);
    return X & 1;
}