XC-3 doesn't work at 20MHz

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
bhags21
Junior Member
Posts: 4
Joined: Mon Jun 28, 2010 6:29 am

XC-3 doesn't work at 20MHz

Post by bhags21 »

Hi there,
I'm trying to run following code on XC-3 board,
but not getting XS1_PORT_8C6 at more than 2.66MHz frequency.
I tried chnaging/increasing clock frequency:
configure_clock_rate (c, 100,8);
but out output at 8C6 doesn't go above 2.66MHz. Why is that?

#include <platform.h>
#include <xs1.h>
#include <print.h>

out buffered port:8 DataOut = XS1_PORT_8C;
out port DataClk = XS1_PORT_1O;
clock c = XS1_CLKBLK_1;
int a;
int i;
int D[64] = { 15,15,15,15,8,8,8,8,15,15,15,15,8,8,8,0,
15,15,15,15,8,8,8,8,15,15,15,15,8,8,8,0,
63,15,63,15,8,8,8,8,15,15,15,15,8,8,8,0,
63,15,63,15,8,8,8,8,15,15,15,15,8,8,8,0};
int main(void)
{
//set_clock_ref(c);
configure_clock_rate (c, 100,8);
configure_out_port(DataOut, c, 0);
configure_port_clock_output(DataClk, c);
start_clock(c);

for(a = 0; a<=255; a++)
{
DataOut <: 0;
for(i=0; i<=63; i++)
{ //DataOut <: B;
//DataOut <: B | 64;
partout(DataOut,8,D);
partout(DataOut,8,D|64);

}
DataOut <: 0;
DataOut <: 128;
DataOut <: 128;
DataOut <: 0;
}
}
also there is no output if i change clck freq. to 20MHz..
configure_clock_rate (c, 100,5);

signals.jpg
Output of Clock and Port 8C(1-7)
(81.39 KiB) Not downloaded yet
signals.jpg
Output of Clock and Port 8C(1-7)
(81.39 KiB) Not downloaded yet
Could you explain me why? and how to fix this problem?
Thanks :)


User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post by paul »

This question is also in our ticketing system - please avoid posting in multiple places as this won't get things answered any quicker!

Firstly, the configure_clock_rate function will raise an exception if you provide an invalid divide (such as 5). If you just hit run without the IO option for Xrun (or the IO server option in the XDE) then you won't see the exception - it will just output nothing. I would recommend investigating the documentation of this function and consider using configure_clock_rate_at_least and configure_clock_rate_at_least.

I ran the following code on an XC-3:

Code: Select all

#include <platform.h>
#include <xs1.h>
#include <print.h>

out buffered port:8 DataOut = XS1_PORT_8C;
out port DataClk = XS1_PORT_1O;
clock c = XS1_CLKBLK_1;
int a;
int i;
int D[64] = { 15,15,15,15,8,8,8,8,15,15,15,15,8,8,8,0,
		15,15,15,15,8,8,8,8,15,15,15,15,8,8,8,0,
		63,15,63,15,8,8,8,8,15,15,15,15,8,8,8,0,
		63,15,63,15,8,8,8,8,15,15,15,15,8,8,8,0};
int main(void)
{
	//set_clock_ref(c);
	configure_clock_rate_at_least(c, 100, 5);
	configure_out_port(DataOut, c, 0);
	configure_port_clock_output(DataClk, c);
	start_clock(c);

	while(1)
	{

	for(a = 0; a<=255; a++)
	{
		DataOut <: 0;
		for(i=0; i<=63; i++)
		{
//			DataOut <: D[i];
//			DataOut <: D[i] | 64;
			partout(DataOut,8,D[i]);
			partout(DataOut,8,D[i]|64);

		}
		DataOut <: 0;
		DataOut <: 128;
		DataOut <: 128;
		DataOut <: 0;
	}
	}
	return 0;
}

... which generates the oscilloscope trace attached to this post. The trace indicates correct operation - the blue trace is the clock at 25Mhz (which is the closest valid divide above 100/5) and the yellow is C6.
Image


The only other things to check are that you are compiling in debug or release mode in the XDE or using -O3 if compiling on the command line?

One other thing to note is that if you set your array to be an array of chars then you don't need to use partout and can do it the way that is commented out in the code snippet above.

Hope that sheds a bit of light on the matter?!

Regards,
Attachments
F0001TEK.JPG
XC 3 Output
(154.8 KiB) Not downloaded yet
F0001TEK.JPG
XC 3 Output
(154.8 KiB) Not downloaded yet
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
bhags21
Junior Member
Posts: 4
Joined: Mon Jun 28, 2010 6:29 am

Post by bhags21 »

Hi Paul,
Thanks for reply, Really appreciated!

However I couldn't make it to work :(
I'm using your code with: configure_clock_rate_at_least(c, 100,5);
XDE Version: 10.4 (build 1647)
Building program in Debug mode(tried with Release mode too)
and this is the outputs I'm getting;
signals_2.jpg
Outputs with
configure_clock_rate_at_least(c, 100,5);
(89.82 KiB) Not downloaded yet
signals_2.jpg
Outputs with
configure_clock_rate_at_least(c, 100,5);
(89.82 KiB) Not downloaded yet
It is really frustrating for me as I can't do even basic stuff that one can expect from powerful processor like XMOS to do in nano-seconds!

Awaiting your reply and suggestions...
User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post by paul »

Could you post a copy of your xn file? I am finding it very difficult to reproduce your issue... If you could zip up the whole project with binaries so I can run it that might help as well.

Regards,
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
bhags21
Junior Member
Posts: 4
Joined: Mon Jun 28, 2010 6:29 am

Post by bhags21 »

Hi Paul,
Thanks once again!
I've attached project-export files in Zip format.
I hope it includes everything that you need.
Please let me know if you require any other info.

Thanks in advance :)
Attachments
XC3.zip
(46.31 KiB) Downloaded 192 times
XC3.zip
(46.31 KiB) Downloaded 192 times
bhags21
Junior Member
Posts: 4
Joined: Mon Jun 28, 2010 6:29 am

Post by bhags21 »

Hi Paul,
No reply from you since 29th June 2010!
What is it that taking you so long??

At-least let me know if you can or will reply??
So I can make up my mind in using XMOS processors in my projects!!

You guys are really letting me down!
User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post by paul »

Things have been very busy lately - but I will endeavour to look at your code zip file as soon as I can.

Please understand that XCore is not a guaranteed support channel. For critical enquiries then please direct it through our ticketing system stating your location and organisation name.

Thankyou for your patience.

Regards,
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
User avatar
paul
XCore Addict
Posts: 169
Joined: Fri Jan 08, 2010 12:13 am
Contact:

Post by paul »

Hi,

I have had a look at your project and it seems that you may be running the Debug binary as when I run that I get ~2Mhz and then running the Release binary I get the expected performance.

This is due to the compiler not having optimizations enabled for the Debug compilation configuration.

Also, to ensure that you are running the releas binary you need to create a "run configuration". This can be achieved by following the instructions in section 4.3 of the Tools user guide found here - http://www.xmos.com/support/documentation

I hope that solves your problem.

Regards,
Paul

On two occasions I have been asked, 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
Post Reply