Problem about bidirectional buffered port

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
YedongWeng
Member
Posts: 8
Joined: Mon Sep 03, 2012 3:40 pm

Problem about bidirectional buffered port

Post by YedongWeng »

The sc_sdram_burst uses the bidirectional buffered port for the bi-directional data bus (DQ).Now I'm working on an application which needs to use 8 bit bidirectional buffered 1-bit port,and I did it in the same way,but it's not working.
codes as follows:

Code: Select all

	buffered port:8 pdata	= XS1_PORT_1B;
out      buffered port:8 pclk	= XS1_PORT_1A;
clock 			clk	= XS1_CLKBLK_5;

int main(void)
{
	pclk <: 0xff;
	set_clock_src(clk,pclk);
	set_port_clock(pdata,clk);
	start_clock(clk);

	pdata	<: 0xff;	//output data
	pclk	<: 0xaa;	//generates clock
	pclk	<: 0xaa;
	sync(pclk);

	clearbuf(pdata);
	pclk	<: 0xaa;	//generates clock for input
	pclk	<: 0xaa;
	sync(pclk);
	pdata :> int temp;	//input data

	while(1);
	return 0;
}
Program was blocked at the input operation(pdata :> int temp;).where can i find some manuals that describe about all the port registers(port timer register,port data register,port shift register,port counter).

Thanks advance.


Guest

Post by Guest »

Code: Select all

clearbuf(pdata);
   pclk   <: 0xaa;   //generates clock for input
   pclk   <: 0xaa;
   sync(pclk);
   pdata :> int temp;   //input data
The sync function actually waits until all the data in the buffers is sent out on the port(There will be no transactions on pclk pin, by the time you read dat on the pin).

So, it should be as below:

Code: Select all

clearbuf(pdata);
   pclk   <: 0xaa;   //generates clock for input
   pclk   <: 0xaa;
   pdata :> int temp;   //input data