Interfacing an XS1 to a processor local bus

Technical questions regarding the XTC tools and programming with XMOS.
AndrewA
Newbie
Posts: 1
Joined: Tue May 24, 2011 5:04 pm

Interfacing an XS1 to a processor local bus

Post by AndrewA »

Hi all,

I'm trying to interface an XS1-L2 to the local bus on a processor. And I'm running into a couple of issues that I can't quite get my head around.

1) I'm using the standard XS1-L2A-QF124 xn configuration file. I'm guessing that this will run the chip at 400MHz but I'd actually like to run it 500MHz, and how do I tell what speed the core is running at anyway?

2) I have a select statement in my code which attempts to drive an LED to mimic one of my input signals:

Code: Select all

	while (1)
	{
		select
		{
			case pin_CS when pinsneq(cs) :> cs :
				if ((cs == 0))
				{
					pin_XLED1 <: 0;
				}
				if ((cs == 1))
				{
					pin_XLED1 <: 1;
				}
				break;
		}
	}
(Obviously I should do something a bit more useful with this signal, but I'm just experimenting)

The CS pin goes low for 200ns and then goes back high.
The LED goes low 250ns after the falling edge of CS.
The LED goes high 620ns after the rising edge of CS.

What can I do to improve this performance? I have pulses a lot narrower than CS to deal with, and I must react on BOTH the rising and falling edges of them.

Thanks for any advice,

A


User avatar
jai
Member
Posts: 15
Joined: Wed Jun 15, 2011 9:20 am

Post by jai »

how do I tell what speed the core is running at anyway?
You may specify the required clock frequency in the XN file.
http://www.xmos.com/support/documentation
XS1-L Clock Frequency Control

or use 'configure_clock_at_least' function defined in <xs1.h>
User avatar
Woody
XCore Addict
Posts: 165
Joined: Wed Feb 10, 2010 2:32 pm

Post by Woody »

Can't you just do this?

Code: Select all

 while (1)
   {
      select
      {
         case pin_CS when pinsneq(cs) :> cs :
            pin_XLED1 <: cs;
            break;
      }
   }
User avatar
Woody
XCore Addict
Posts: 165
Joined: Wed Feb 10, 2010 2:32 pm

Post by Woody »

If this is just an example and you want to have low latency when on both edges without detecting the edge then how about this?

Code: Select all

 while (1)
   {
      select
      {
         case pin_CS when pinsneq(0) :> cs :
            pin_XLED1 <: 0;
            break;
      }
      select
      {
         case pin_CS when pinsneq(1) :> cs :
            pin_XLED1 <: 1;
            break;
      }
   }