XMOS Toggle speed

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
erikszah
New User
Posts: 3
Joined: Thu Mar 18, 2010 3:10 pm

XMOS Toggle speed

Post by erikszah »

Hi,
I read that xmos can toggle pin with 100MHz speed but the maximum speed that I have obtained is only 10Mhz speed.
Can somebody explain me how can I increase toggle speed. Is it even possible?
Thank you!

Erik


User avatar
Jerry
Member++
Posts: 30
Joined: Sat Dec 12, 2009 7:14 pm
Location: Silicon Valley

Post by Jerry »

If you're trying to toggle an output pin with code like this:

Code: Select all

out port p = XS1_PORT_1A;

int main(void)

{

        while(1) {
             p <: 0;
             p <: 1;
        }
}
you won't get anything near a 100MHz toggle rate. About the best you're going to be able to do is to generate a 50 MHz output using a clock block with code like this:

Code: Select all

out port Clockp = XS1_PORT_1A ;
clock clk = XS1_CLKBLK_1 ;

int main (void) 

{

     configure_clock_rate (clk , 100 , 2);
     configure_port_clock_output (Clockp , clk);
     start_clock (clk);

     while(1)
         ;

}
User avatar
erikszah
New User
Posts: 3
Joined: Thu Mar 18, 2010 3:10 pm

Post by erikszah »

Thanks!
That is what I wanted to know.
And how is with input, how fast can I recive signal?
For example if I have 24MHz 8bit parallel signal, can XMOS manage to read it and pass it to other thread.
Thanks!

Erik
User avatar
Jerry
Member++
Posts: 30
Joined: Sat Dec 12, 2009 7:14 pm
Location: Silicon Valley

Post by Jerry »

XMOS chips can sample input ports up to the speed of the reference clock, which is 100 MHz.
User avatar
Woody
XCore Addict
Posts: 165
Joined: Wed Feb 10, 2010 2:32 pm

Post by Woody »

erikszah wrote:For example if I have 24MHz 8bit parallel signal, can XMOS manage to read it and pass it to other thread.
You might well want to setup a buffered port for this so that 4 consecutive 8bit parallel signals are concatenated into a 32 bit word. This is then input at 6MHz which can then be sent down a channel to another thread if you want.

If there is a data valid signal with the parallel data, then the port can handle that automatically, so that the 8bit data is only sampled when the valid signal is asserted.
User avatar
erikszah
New User
Posts: 3
Joined: Thu Mar 18, 2010 3:10 pm

Post by erikszah »

Thanks!
Now everything is clear.

Erik
ikellymo
Junior Member
Posts: 7
Joined: Tue Jun 11, 2013 4:23 am

Post by ikellymo »

If you're trying to toggle an output pin with code like this:

Code:
out port p = XS1_PORT_1A;

int main(void)

{

while(1) {
p <: 0;
p <: 1;
}
}


you won't get anything near a 100MHz toggle rate. About the best you're going to be able to do is to generate a 50 MHz output using a clock block with code like this:
Why is this? What are the timing issues with using the <: instructions? I think I may be running into a similar problem:
http://www.xcore.com/forum/viewtopic.php?f=26&t=2259

Thank you!
User avatar
dan
Experienced Member
Posts: 102
Joined: Mon Feb 22, 2010 2:30 pm

Post by dan »

If you take your code and disassemble it, find the section that you are interested in and count the instructions it takes to go round the loop with the out instructions in it, and bear in mind that the logical core running the code will have an instruction execution rate somewhere between 50 and 125 MIPS (depending what cores are running), the timing issues should be clear.

To simply toggle an output pin quickly a good way is to use a buffered 1-bit port, set the transfer width to 32. That way, only one instruction is required (which can load the port with 0xAAAAAAAA), and after that the port will clock that data out.

Bear in mind though that unless you do something to alter the port setup, it'll be running at 100 MHz so your toggle rate would be 50 MHz in this case.

Can you post your code and be more specific about what you are trying to achieve?

For input of higher speed signals/data, the situation is slightly more complex however the point above about the instruction rate still applies.