Page 1 of 1

On using single bit and multi-bit ports

Posted: Fri Sep 24, 2021 4:06 pm
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

Re: On using single bit and multi-bit ports

Posted: Fri Sep 24, 2021 10:20 pm
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

Re: On using single bit and multi-bit ports

Posted: Mon Sep 27, 2021 9:23 am
by erlingrj
Great, thanks alot for your help!