XCORE-200 Multichannel Audio DSP App Note?

Technical discussions related to any XMOS development kit or reference design. Eg XK-1A, sliceKIT, etc.
User avatar
infiniteimprobability
XCore Legend
Posts: 1120
Joined: Thu May 27, 2010 10:08 am

Re: XCORE-200 Multichannel Audio DSP App Note?

Postby infiniteimprobability » Thu Apr 26, 2018 10:14 am

Sorry - missed this one. Short answer is to use lib_dsp. It's newer and sc_dsp_filters is no longer maintained. There are a wider range of functions in lib_dsp and many are now optimised for xCORE200 dual issue and extended instructions which massive increases throughput (up to 2x) compared with XS1 for the same clock rate.
stnschrdr
Member
Posts: 10
Joined: Thu Jan 24, 2019 7:35 pm

Postby stnschrdr » Fri Feb 08, 2019 6:52 pm

Hi infiniteimprobability,

In regards to your post above on Thu Jan 18, 2018 11:48 pm - thank you this is a helpful template for DSP on real-time audio! I'm just now trying to equate this with the recommendations for writing DSP code for real audio described in Section 5.7.2 of 'USB Audio Design Guide'. I'd like to make sure I'm using their recommendation here as I'm trying to apply FIR filters with some involved math operation to many audio channels going out to through LINE OUT to speakers. To this may require its own allocated memory. Here are my questions:

1) Section 5.7.2 of the guide says for adding DSP I will probably want to free up Core functionality. I am not using SPDIF, ADAT, or MIDI. How could I do this? Would I just set the defined 'SPDIF_TX' in 'customdefines.h' of the 'app_usb_aud_xk_216_mc' application to 0? Is seems the other audio interfaces are default to off in 'devicedefines.h'.

2) Section 5.7.2 also says to add a DSP Core. How do I do this formally? Would I simply write something like this with in the par{} of main() in the 'modlue_usb_audio' (or alternatively within the user_main.h under the USER_MAIN_CORES define) :

on tile[0].core[?]: dsp_task();

What unused cores can I used for DSP? Because they recommend synchronized data transfer I need another core, using a 'normal channel' communication which can only be used between Tasks on different cores.

3) Section 5.7.2 (and and XMOS Youtube video) further advises using 3 xC channels on this new Core. Is there a reference I can follow to create these channels properly?

Thanks!
User avatar
infiniteimprobability
XCore Legend
Posts: 1120
Joined: Thu May 27, 2010 10:08 am

Postby infiniteimprobability » Mon Feb 11, 2019 5:13 pm

1) Section 5.7.2 of the guide says for adding DSP I will probably want to free up Core functionality. I am not using SPDIF, ADAT, or MIDI. How could I do this? Would I just set the defined 'SPDIF_TX' in 'customdefines.h' of the 'app_usb_aud_xk_216_mc' application to 0? Is seems the other audio interfaces are default to off in 'devicedefines.h'.


If you are using a XU216 then you will have bags of free resources already. Yes, most stuff is switched off, although be aware that the Makefile build configs over-rule the customdefines stuff (hence lots of ifdefs). So check there too.
2) Section 5.7.2 also says to add a DSP Core. How do I do this formally? Would I simply write something like this with in the par{} of main() in the 'modlue_usb_audio' (or alternatively within the user_main.h under the USER_MAIN_CORES define):

on tile[0].core[?]: dsp_task();


I would use the example provided here rather than 5.7.2. It is more up-to date. It reserves a whole core (up to 100MIPS) for DSP and you can use 99.9% of it because of the low channel overhead.

What unused cores can I used for DSP? Because they recommend synchronized data transfer I need another core, using a 'normal channel' communication which can only be used between Tasks on different cores.

ANy of them. There are constraints - xud must get 80MIPS (500/n cores must be over 80 on that tile). Compile with -report to see what's used.


3) Section 5.7.2 (and and XMOS Youtube video) further advises using 3 xC channels on this new Core. Is there a reference I can follow to create these channels properly?

Sorry - don't understand this question as you only need one channel to hook some DSP into the audio system, as per this example.
stnschrdr
Member
Posts: 10
Joined: Thu Jan 24, 2019 7:35 pm

Postby stnschrdr » Tue Feb 12, 2019 11:21 pm

1) Section 5.7.2 of the guide says for adding DSP I will probably want to free up Core functionality. I am not using SPDIF, ADAT, or MIDI. How could I do this? Would I just set the defined 'SPDIF_TX' in 'customdefines.h' of the 'app_usb_aud_xk_216_mc' application to 0? Is seems the other audio interfaces are default to off in 'devicedefines.h'.


If you are using a XU216 then you will have bags of free resources already. Yes, most stuff is switched off, although be aware that the Makefile build configs over-rule the customdefines stuff (hence lots of ifdefs). So check there too.

I'm using Manufacturing Part # XK-AUDIO-216-MC-AB (XE216 Audio Platform w/ Debugger). I'll check the Makefile build configs - thanks.


2) Section 5.7.2 also says to add a DSP Core. How do I do this formally? Would I simply write something like this with in the par{} of main() in the 'modlue_usb_audio' (or alternatively within the user_main.h under the USER_MAIN_CORES define):

on tile[0].core[?]: dsp_task();


I would use the example provided here rather than 5.7.2. It is more up-to date. It reserves a whole core (up to 100MIPS) for DSP and you can use 99.9% of it because of the low channel overhead.

Ok, I'll try to work with the example provided here rather than 5.7.2. After all your channel attenuation DSP example did work for me - "If it ain't broke, then don't fix it", as they say. :)


What unused cores can I used for DSP? Because they recommend synchronized data transfer I need another core, using a 'normal channel' communication which can only be used between Tasks on different cores.

ANy of them. There are constraints - xud must get 80MIPS (500/n cores must be over 80 on that tile). Compile with -report to see what's used.

Ok, will do. Although I was a bit confused on how to declare a core to use and see which ones/how many are available. I didn't find anything in the Programmers Guide on where all available cores are defined and how to define new ones. Also, the guide uses the notation tile[x]core[y] to specify which core and tile I am applying tasks to, but I don't see this notation in the Example code - as you say maybe the guides are not up-to-date and some other notation is used now.


3) Section 5.7.2 (and and XMOS Youtube video) further advises using 3 xC channels on this new Core. Is there a reference I can follow to create these channels properly?

Sorry - don't understand this question as you only need one channel to hook some DSP into the audio system, as per this example.

In Section 5.7.2 point 2. "Add another core to do DSP. This core will probably have three XC channels (type 'chan' communication, I'm guessing): one channel to receive samples from decoupler core and another to output to the audio driver - this way the core 'intercepts' audio data on its way to the audio driver; the third channel can receive control commands from Endpoint 0."

It looks like you just use the one 'c_dsp' chanend. I'm fine to use this one channel if its sufficient. From this Youtube video the XMOS instructor shows two different connections connecting a DSP (or MIXER) core to the 'Decouple' and 'Audio' cores: https://www.youtube.com/watch?v=xfRUxbUN2SE (time stamp 4.35). I guess a third channel would be used for USB audio control like mute, volume up, volume down.

Who is online

Users browsing this forum: No registered users and 1 guest