XMOS Microphone Array Board: how to share clock definition Topic is solved

New to XMOS and XCore? Get started here.
saul01
Member
Posts: 14
Joined: Thu Feb 16, 2017 12:57 am

XMOS Microphone Array Board: how to share clock definition

Postby saul01 » Thu Feb 16, 2017 1:36 am

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
View Solution
henk
Respected Member
Posts: 346
Joined: Wed Jan 27, 2016 5:21 pm

Postby henk » Thu Feb 16, 2017 9:06 am

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
saul01
Member
Posts: 14
Joined: Thu Feb 16, 2017 12:57 am

Postby saul01 » Thu Feb 16, 2017 7:10 pm

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!
saul01
Member
Posts: 14
Joined: Thu Feb 16, 2017 12:57 am

Postby saul01 » Fri Feb 17, 2017 6:44 pm

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!
User avatar
infiniteimprobability
XCore Expert
Posts: 875
Joined: Thu May 27, 2010 10:08 am
Contact:

Postby infiniteimprobability » Fri Feb 17, 2017 9:25 pm

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)
saul01
Member
Posts: 14
Joined: Thu Feb 16, 2017 12:57 am

Postby saul01 » Thu Feb 23, 2017 6:38 pm

Thanks!
I did change it to a table :)
I'll take a look at the clock. By the way, do you guys host training?

Return to “Getting started”

Who is online

Users browsing this forum: No registered users and 3 guests