On using single bit and multi-bit ports

Technical discussions around xCORE processors (e.g. xcore-200 & xcore.ai).
Post Reply
erlingrj
Member++
Posts: 16
Joined: Tue Aug 10, 2021 1:21 pm

On using single bit and multi-bit ports

Post by erlingrj »

Hi there.

I am interested in an application where I need to control more single bit pins than are available on the Tiles. I have a few questions about the different ports.
1. Is there any reason for not using a 4bit or an 8bit port as if it was a single bit port? I.e. only routing one of the pins and only reading/writing to this particular pin?
2. Can I also pass a 4/8bit port to a e.g. the UART peripheral library which expects a single pin, and it will only drive the least significant bit of the port?
3. Is there any conflict in using both XS1_PORT_4A and XS1_PORT_1A at the same time? I.e. is the least significant bit of 4A the same pin as 1A)

Thanks for your help


User avatar
CousinItt
Respected Member
Posts: 360
Joined: Wed May 31, 2017 6:55 pm

Post by CousinItt »

Hi,

1) You can just use a single pin in a multi-pin port instead of a single-pin port. Things might get a bit more complicated if you are using buffering or want to do something with the other pins, but if it's just simple GPIO you should be fine. xmos also provides a library to enable flexible use of multi-pin ports (user guide).

2) The UART library makes use of the GPIO library. The user guide says:
If you are using the general UART Rx/Tx components then the UART line can be connected to a bit of any port. The other bits of the port can be shared using the GPIO library. Please refer to the GPIO library user guide for restrictions on sharing bits of a port (for example, all bits of a port need to be in the same direction - so UART rx and UART tx cannot be put on the same port).
3) In general PORT_4A and PORT_1A use different pins. Take a look at the data sheet for the device you're interested in, or look at the portmap spreadsheet.

HTH
erlingrj
Member++
Posts: 16
Joined: Tue Aug 10, 2021 1:21 pm

Post by erlingrj »

Great, thanks alot for your help!
Post Reply