Using ADC in Audio-Project

All technical discussions and projects around startKIT
User avatar
xaerox
Active Member
Posts: 43
Joined: Thu Apr 30, 2015 6:12 pm

Using ADC in Audio-Project

Post by xaerox »

Hello everybody!
I'm trying to include ADC (startkit_adc) in my existing project. The startkit adc example is the base which I used.

Code: Select all

par
{
     on stdcore[0]: adc_task(i_adc, c_adc, 0);
     on stdcore[0]: adc_processing(i_adc); //this function is declared in main.xc; like the adc_example
     on stdcore[0]: audio_io( c_aud_dsp );
     on stdcore[0]: audio_stream ( c_aud_dsp );
}
Yeah it's working, but why can I hear noise instead of music? I can't see any errors and the audio-processing is working without the adc-example, too.

I just want to make the cut-off frequency of a bandpass-Filter variable by using ADC.

I hope you can understand my problem.

greetings, Thomas.

***EDIT***
It seems, that nobody can help me? Now I tried to use another allocation on the different cores:

Code: Select all

par
{
     on tile[0].core[0]: adc_task(i_adc, c_adc, 0);
     on tile[0].core[0]: adc_processing(i_adc); //this function is declared in main.xc; like the adc_example
     on tile[0].core[0]: audio_io( c_aud_dsp );
     on tile[0].core[0]: audio_stream ( c_aud_dsp );
}
Now there is an error like this:
"statement placed on a core must be call to combinable function"
So what I'm doing wrong now and how can I use different cores for 2 different main-tasks (adc and audio).
I have no idea where the noise is coming from, so I'm trying to disconnect the adc-part from the audio-part.


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

Post by infiniteimprobability »

The first code listing should be OK. You are using the old reference for tile (tile used to be core, core used to be thread) but should be OK. This is how it would look in new speak.

Code: Select all

par
{
     on tile[0]: adc_task(i_adc, c_adc, 0);
     on tile[0]: adc_processing(i_adc); //this function is declared in main.xc; like the adc_example
     on tile[0]: audio_io( c_aud_dsp );
     on tile[0]: audio_stream ( c_aud_dsp );
}
You are only declaring 4 cores so each will get 1/4 of the MIPS. If you removed the adc tasks, leaving audio_io and audio_stream, they would still get 1/4 of the MIPS each. This leads me to think it's not a performance issue (especially as it's working without ADC) because you haven't lowered the performance of the audio stuff by adding the ADC.

Using

Code: Select all

on tile[0].core[0]: 
probably won't work. That will require everything to be written and declared as combinable and all tasks get flattened into a single large select by the compiler. Effectively they all share the MIPS of one core..

Best guess at the moment is that the ADC is upsetting the audio - it uses a trigger port, nominally this one on startkit:

Code: Select all

#define ADC_TRIG_PORT XS1_PORT_1A //ADC trigger pin. Defined by startKIT hardware
Check to see that this pin is not corrupting something in the audio hardware..
It seems, that nobody can help me?
Give it time! You only posted yesterday ;-)
User avatar
xaerox
Active Member
Posts: 43
Joined: Thu Apr 30, 2015 6:12 pm

Post by xaerox »

Hi,
thank you very much.
It's working now. Another issue was that I used "printstr" which makes noise.

[problem solved]
User avatar
infiniteimprobability
XCore Legend
Posts: 1126
Joined: Thu May 27, 2010 10:08 am

Post by infiniteimprobability »

Ahh yes - of course. That would do it. Glad you found out what it was and got it going. Thanks for sharing this.

You can still use printing though in all but the tightest inner loops - you just need to switch to real-time xscope printing.

This is an important subject so I trawled through an old forum post and created an FAQ to cover this:

http://www.xcore.com/questions/3296/wha ... e-printing