Page 1 of 1

XMOS Microphone Array Board: how to share clock definition

Posted: Thu Feb 16, 2017 1:36 am
by saul01
Dear All,
I just started reading and using the XMOS XC-200 chip (XUF216-512-FB236).
I bought a Microphone Array board (circle shape board). The board comes with:
Stereo DAC CS43L21, USB, Ethernet, Buttons, LEDs, and seven microphones, among other things.

I need to implement a Virtual COMM Port on USB and also send data to the DAC and capture data from the Microphone(s).
I have come against a compile issue:
On usb_lib, XUD_Ports.xc: on USB_TILE: clock rx_usb_clk = XS1_CLKBLK_4;
On my app main.xc: clock bclk = on tile[1]: XS1_CLKBLK_4;

..so, how would one go about fixing this problem? both, USB and DAC, need to configure the clock (but the USB is entrenched way far from my application code in lib_usb).

Thank you,

Saul

Re: XMOS Microphone Array Board: how to share clock definition

Posted: Thu Feb 16, 2017 9:06 am
by henk
Hi Saul,

You will have to change one of them to use a different clock block. Eg, change BCLK to use clock block 1, 2, 3, or 5.

There are 6 clock blocks per tile, one of them is the reference clock (100 MHz), you may need to put USB on the tile that has sufficient free resources.

Cheers,
Henk

Re: XMOS Microphone Array Board: how to share clock definition

Posted: Thu Feb 16, 2017 7:10 pm
by saul01
Thanks Henk!
I did that and now it compiles fine, but I get no audio from the Cirrus Logic DAC:

Code: Select all

            case i2s.send(size_t index) -> int32_t sample:
                sample = (int)(15000*sin(2 * M_PI * (double)Fo/Fs * gTestToneIdx));
                if (++gTestToneIdx == 100)
                {
                    gTestToneIdx = 0;
                }
            break;
I am trying to do a simple 480Hz sine wave. It seems there is something wrong with my sine wave, maybe is the data format?, do I need to do 2's complement or something other ?
By the way, is there training by XMOS?
Thanks!

Re: XMOS Microphone Array Board: how to share clock definition

Posted: Fri Feb 17, 2017 6:44 pm
by saul01
HI,
By looking at other posts I noticed that I should had scaled my sine wave to 2^31 -1 instead of just by 15000..... I'm still intrigued by this, because even if it was only by 15000, I think I should had been able to see a small amplitude waveform, but did not see much. The other aspect that I changed was to look at the sample "index", and only supply data when the index was 0.
Sorry to mention this since this is outside of the topic of the original discussion....

Thanks!

Re: XMOS Microphone Array Board: how to share clock definition

Posted: Fri Feb 17, 2017 9:25 pm
by infiniteimprobability

Code: Select all

                sample = (int)(15000*sin(2 * M_PI * (double)Fo/Fs * gTestToneIdx));
This is almost definitely going to break timing in a fixed point processor - I would recommend either:

- use dsp_math_sin from lib_dsp
- generate a sine table before the while(1) and index off that

Probably the second one is the easiest. By the way - did you look at the LRclock on a scope? That will soon tell you if one of your I2S callbacks is taking too long and breaking timing (the I2S waveform will get stretched)

Re: XMOS Microphone Array Board: how to share clock definition

Posted: Thu Feb 23, 2017 6:38 pm
by saul01
Thanks!
I did change it to a table :)
I'll take a look at the clock. By the way, do you guys host training?