Conflicting Ports Topic is solved

Technical questions regarding the xTIMEcomposer, xSOFTip Explorer and Programming with XMOS.
RedDave
Active Member
Posts: 33
Joined: Fri Oct 05, 2018 4:26 pm

Conflicting Ports

Postby RedDave » Mon Nov 26, 2018 3:55 pm

On the XE216-512-TQ128 (i.e. on the eXplorerKit), Port 8B uses the same pins as ports 4C and 4D.

If I write a task that creates a square wave on the pins of port 8B, all is well.
If I then declare a global variable alongside the original declaration for port 4D, port 8B stops working (see below). This occurs even if I do not reference the 4 bit port variable anywhere in my code.
If I output a (different) square wave to the 4 bit port, this works whether or not the 8 bit port is used. i.e. the 4 bit port takes precedence.

Code: Select all

on tile[0] : out port toggle_port = XS1_PORT_8B;
on tile[0] : out port toggle_port2 = XS1_PORT_4D;


For ideal behaviour would be that this would not build; in the same way that using the same port twice fails.
Since that is not the case, is the behaviour of this circumstance documented anywhere? Is there any way of catching this kind of error at build time? [I know I can just map out the pins and check, but having a compiler catch errors is always helpful].

n.b. I was checking all of this to test for conflicts with USB PHY. I had written some code that used the four bit port that conflicts with the 8 bit port used by the USB. It built but did not work. Using the actual 8 bit port used does not build (which is nicer).
View Solution
User avatar
mon2
XCore Legend
Posts: 1298
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Mon Nov 26, 2018 11:43 pm

If I then declare a global variable alongside the original declaration for port 4D, port 8B stops working (see below). This occurs even if I do not reference the 4 bit port variable anywhere in my code.
If I output a (different) square wave to the 4 bit port, this works whether or not the 8 bit port is used. i.e. the 4 bit port takes precedence.


That is the expected behaviour of your code sample.

Is that your concern? Inside the datasheet of the XMOS CPU, you will see overlapping of smaller width ports. In this case, port 4D overlaps the 8B port. So if you decide to use the port 4D then you have peeled off the 4 bits away from the port 8B (ie. 8B2..8B5 are lost due to the port 4D assignment but the remaining pins on port 8B are available OR you may access them via port 4C). That is, the 4 bit port has a higher priority than the 8 bit port. Moving forward, any other overlap to the LEFT of the same port table will steal away the pins from the RIGHT side pin labels for their use.

Hope this helps.
RedDave
Active Member
Posts: 33
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Mon Nov 26, 2018 11:49 pm

That helps. Thank you.

Is this documented somewhere? I failed to find it, but there are probably plenty of places it could be.

Also, does USB PHY take priority despite bring decaled as the 8 bit? I got the USB working on tile[0] and then started spamming the associated 4 bit port. The USB continued to work.
User avatar
mon2
XCore Legend
Posts: 1298
Joined: Thu Jun 10, 2010 11:43 am
Contact:

Postby mon2 » Tue Nov 27, 2018 12:07 am

Yeah, documentation is all over the place but "The Truth is out there" :)

See section 7.1 of the following document:

https://www.xmos.com/developer/download ... 283%29.pdf

Code: Select all

https://www.xmos.com/developer/download/private/Introduction-to-XS1-ports%283%29.pdf


For the USB PHY and overlapping ports review, see this port map chart:

https://www.xmos.com/developer/publishe ... es-portmap

Code: Select all

https://www.xmos.com/developer/published/xcore-200-devices-portmap


So, from this spreadsheet:

a) if the USB PHY is enabled then
b) some of the related ports will have a YELLOW background port - if YELLOW BACKGROUND then those ports are NOT available for your use but
c) if the port label background is clear or WHITE then that port IS available still for your use
Also, does USB PHY take priority despite bring decaled as the 8 bit? I got the USB working on tile[0] and then started spamming the associated 4 bit port. The USB continued to work.


Correct - 8B port is lost and is noted with the YELLOW background in the spreadsheet. 4B port is available and is noted with the WHITE background in the spreadsheet.

Hope this helps.
RedDave
Active Member
Posts: 33
Joined: Fri Oct 05, 2018 4:26 pm

Postby RedDave » Tue Nov 27, 2018 9:39 am

Thank you very much. That all makes sense.

That spreadsheet had previously seemed self contradictory with some rows only partially coloured.

Who is online

Users browsing this forum: No registered users and 31 guests