Out_port_strobed_master Behaviour

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Out_port_strobed_master Behaviour

Post by Andy »

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:
Attachments
strobed_wave.jpg
Waveform output
(18.93 KiB) Not downloaded yet
strobed_wave.jpg
Waveform output
(18.93 KiB) Not downloaded yet


User avatar
leon_heller
XCore Expert
Posts: 546
Joined: Thu Dec 10, 2009 10:41 pm
Location: St. Leonards-on-Sea, E. Sussex, UK.
Contact:

Post by leon_heller »

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

Post by Andy »

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

Post by richard »

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

Post by richard »

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

Post by Andy »

That fixed it Richard!
Post Reply