Out_port_strobed_master Behaviour

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Out_port_strobed_master Behaviour

Postby Andy » Fri Feb 19, 2010 5:23 pm

I've noticed that configuring a port using configure_out_port_strobed_master() causes the port to be driven high for a period at the start of the program. Is there a way to stop this?

Code: Select all

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

on stdcore[2] : out buffered port:8 outP = XS1_PORT_1A ;
on stdcore[2] : out port outR = XS1_PORT_1B ;
on stdcore[2] : clock clk = XS1_CLKBLK_1 ;

int main(void)
{
	par
	{
		on stdcore[2]:
		{
			configure_out_port_strobed_master(outP , outR , clk , 0);
			start_clock(clk);
			outP <: 0xAA;
		}
	}
	
	return 0;
}
Waveform attached:
You do not have the required permissions to view the files attached to this post.
User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.

Postby leon_heller » Fri Feb 19, 2010 6:40 pm

Try writing a zero to it before you make it an output. That is commonly done with other MCUs to avoid that sort of problem.

Leon
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Postby Andy » Fri Feb 19, 2010 6:52 pm

Thanks for the suggestion Leon - but it doesn't seem to work.

I took the code from one of the examples in the documentation, so I assume this is the normal behaviour (but can't work out why or if it can be changed).
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Postby richard » Fri Feb 19, 2010 8:39 pm

This looks like a possible bug. I've reproduced the issue and am looking into it.
richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Postby richard » Fri Feb 19, 2010 8:54 pm

Try adding the following function to your project and replacing calls to configure_out_port_strobed_master() with my_configure_out_port_strobed_master()

Code: Select all

extern void __set_port_out(void port p, unsigned initial);

static void my_configure_out_port_strobed_master(void port p, out port readyout,
                                                 const clock clk, unsigned initial)
{
  set_port_mode_data(p);
  __set_port_out(p, initial);
  set_port_clock(p, clk);
  set_port_strobed(p);
  set_port_master(p);
  clearbuf(p);
  set_port_ready_src(readyout, p);
  set_port_mode_ready(readyout);
}
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Postby Andy » Fri Feb 19, 2010 9:42 pm

That fixed it Richard!

Who is online

Users browsing this forum: No registered users and 0 guests