I am a student researcher attempting to use the xCORE-200 MC Audio board for DSP. I am very new to xmos and DSP in general, but I have been spending a lot of time reading the manuals and code examples. I can use xTime Composer to successfully run the I2S loopback demo (AN00162), and I have read over the code and feel that I understand it well enough. However, when I try modify the i2s_loopback function to display the sample, the loopback stops working and I hear a high pitch sound. I suspect this is because I am interrupting the real time ADC and DAC. I do not understand why i2s stops working when I try to modify it. Please note that I have redirected stdout to the XTAG to preserve realtime functionality. For example, here is a custom interface I made:
Code: Select all
[[distributable]]
void read_signal(server interface share_signal_if i) {
printf("Starting task: read_signal\n");
while(1) {
select {
case i.share(int32_t sample):
printf("Received sample: %d\n", sample);
xscope_int(0, sample);
break;
}
}
}
Code: Select all
case i2s.receive(size_t n_chans, int32_t in_samps[n_chans]):
first_sample = in_samps[0];
delay_microseconds(10);
for (int i = 0; i < n_chans; i++) samples[i] = in_samps[i]; // copy samples
i.share(test); // works just fine
test++;
if (test >= 10) {
test = 0;
}
break;
Code: Select all
case i2s.receive(size_t n_chans, int32_t in_samps[n_chans]):
first_sample = in_samps[0];
delay_microseconds(10);
for (int i = 0; i < n_chans; i++) samples[i] = in_samps[i]; // copy samples
i.share(first_sample); // breaks loopback
test++;
if (test >= 10) {
test = 0;
}
break;
The end goal of this project is to read audio from a microphone, perform some DSP (specifically active noise canceling), and output through a speaker. I am just using a small interview microphone that plugs into a 3.5mm jack, but the I2S loopback does not work with that, so any information on that front would also be appreciated.
Thank you for your time in reading this message. Any information on how to get started with this will be much appreciated.