Trouble reading a specific 4 pin port

Technical questions regarding the XTC tools and programming with XMOS.
shaw
Experienced Member
Posts: 64
Joined: Fri Mar 25, 2011 12:36 am

Trouble reading a specific 4 pin port

Post by shaw »

We are working on a project based on the XCORE.AI multi-channel audio board( using XU316-1024-FB265-C32). We have designed new hardware, we are keeping the critical XMOS connections the same as they were on the AI Eval board. The Board has successfully been powered up and runs our XMOS firmware. Basic audio operation is functional and we are able to Debug(xgdb/XTAG4) and runsoftware, on our board.

I've now run into an unusual problem with accessing a multipin port on TIle 1. When I run the following, everything runs as expected. I'm able to read PORT4A and get the expected results.

// Static variables
on tile[1] : in buffered port:4 test_port = XS1_PORT_4A;
int value = 0;
int status = FAIL;
...
{
...
// configure port
configure_in_port_no_ready(test_port, ref);
set_port_pull_up(test_port); // pull ups enabled/disabled here

// read port
test_port :> value;
if(value != 0)
status = SUCCESS;
...
}


Results: When I enable the pull ups, status is SUCCES, as expected. When I disable pull ups, status is FAIL as expected. If I look at the (4) port pins with a scope, they are high when pulled up and all low when pulled down. It all looks as expected.

When I make this one single change to the port being used, and run the same test, status is FAIL whether pull ups are enabled or NOT enabled. Always reads's 0's. If I look at the (4) port pins with a scope, they are high when pulled up and all low when pulled down. But they only read as low.
on tile[1] : in buffered port:4 test_port = XS1_PORT_4D;

note: All pins in Both PORT4A and PORT4D are left open, with very light pull downs.

Am I missing something simple or is there something about this port4D on Tile 1, that would prevent me from reading it correctly.?

Thanks
Joe
Verified
Experienced Member
Posts: 98
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

A couple of hazards here.

The port is defined as a buffered port so will only be sampled on rising edges of the clock associated with that port which in this case appears to be a clock called "ref" but there's no definition of that given. What rate is this clock running at?

Secondly the value from the port is sampled immediately after the pull ups are turned on so I'd expect the port to read 0s for at least 100ns or so. Depending on the speed of your "ref" clock you will get different results from this program.

For reliable results you could add a delay_microseconds(1); after turning the pullups on before reading the port.

Joe
XMOS hardware grey beard.
shaw
Experienced Member
Posts: 64
Joined: Fri Mar 25, 2011 12:36 am

Post by shaw »

Joe, thanks for feedback. I've added changes below and reran. Same result. The thing that seems odd to me is the fact that it works on PORT4A and doesn't appear to work on PORT4D. Is there anything unique about tile 1 PORT4D, or anything else that I may have done that could affect PORT4A differently than PORT4D.

// Static variables
on tile[1] : in buffered port:4 test_port = XS1_PORT_4A;
int value = 0;
int status = FAIL;
clock ref = XS1_CLKBLK_REF; // XMOS tile reference clock: 100Mhz
...
{
...
// configure port
configure_in_port_no_ready(test_port, ref);
set_port_pull_up(test_port); // pull ups enabled/disabled here
delay_microseconds(1);

// read port
test_port :> value;
if(value != 0)
status = SUCCESS;
...
}
Joe
Verified
Experienced Member
Posts: 98
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

4D on tile 1 was used for xscope on the mc audio board, how is it connected now or do you not use xscope? If your program was built with xscope enabled it will be enabling that link and disabling port 4D
XMOS hardware grey beard.
shaw
Experienced Member
Posts: 64
Joined: Fri Mar 25, 2011 12:36 am

Post by shaw »

I'm not intending to use XSCOPE. But it does appear to be enabled in the makefile and XN file.

Is there a simple way to disable it, Or do I have to pull it out from spots it is used?
Joe
Verified
Experienced Member
Posts: 98
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

just remove the -fxscope option from compile is probably easiest. Should be able to leave it in the XN.
XMOS hardware grey beard.
shaw
Experienced Member
Posts: 64
Joined: Fri Mar 25, 2011 12:36 am

Post by shaw »

I think I have to remove a bit more, but I believe this is it. Thank-you for the assistance.