Skip to main content

Pin alternate functions (multiplexing)

All 32 I/Os work as general-purpose analog or digital pins. Fourteen of them can also be switched to a dedicated communication interface, and those interfaces share pins, so enabling one takes its pins away from the others. The table below is the single place that mapping is recorded: read down a column to see which GPIOs an interface consumes, or across a row to see what a given pin can become.

I/O voltage range

When a pin is used for a dedicated communication interface, it cannot be used as a general-purpose I/O, and more importantly, it cannot support the high voltage range of regular I/Os (-25 V to +25 V). Disabling the communication interface will restore the pin to its original I/O function and voltage range.

All alternate functions​

GPIOSPII2CUARTJTAG *SWD *CANRS485RS232
DA0-DA15
DA16MOSI_0SDA_0RX_0TDI_0SWDIO_0
DA17MISO_0TDO_0
DA18SCK_0SCL_0TX_0TCK_0SWCLK_0
DA19TMS_0
DA20MOSI_1SDA_1RX_1TDI_1SWDIO_1
DA21MISO_1TDO_1
DA22SCK_1SCL_1TX_1TCK_1SWCLK_1
DA23TMS_1
DA24CANHA(+) 0
DA25CANLB(-) 0
DA26A(+) 1
DA27B(-) 1
DA28TX
DA29RX
DA30-31

DA0 to DA15 and DA30 to DA31 have no alternate function and are always available as general-purpose I/O.

What this costs you​

Reading the table by interface:

InterfacePins it takesAlso blocks
SPI 0DA16, DA17, DA18I2C 0, UART 0, JTAG 0, SWD 0
SPI 1DA20, DA21, DA22I2C 1, UART 1, JTAG 1, SWD 1
I2C 0DA16, DA18SPI 0, UART 0, JTAG 0, SWD 0
I2C 1DA20, DA22SPI 1, UART 1, JTAG 1, SWD 1
UART 0DA16, DA18SPI 0, I2C 0, JTAG 0, SWD 0
UART 1DA20, DA22SPI 1, I2C 1, JTAG 1, SWD 1
CAN 0DA24, DA25RS485 0
RS485 0DA24, DA25CAN 0
RS485 1DA26, DA27-
RS232DA28, DA29-

So SPI, I2C and UART on the same index are mutually exclusive, and CAN shares its pins with RS485 0. Everything else can run at the same time. RS232 has dedicated pins and never conflicts.

* JTAG and SWD: Not currently supported

JTAG and SWD are not currently supported and will be implemented in a future release. The AT1000 device is designed to support JTAG and SWD protocols, but the implementation is not yet available in the current version of the API. Please check back for updates on this feature.

NOTE about RS422

An RS422 interface can be implemented by combining the two available RS485 interfaces. One pair (A(+) and B(-)) can be used for transmitting data, while the other pair (A(+) and B(-)) can be used for receiving data.

Enabling an interface configures its pins automatically. Attempting to enable two interfaces that share pins raises an error at configure(), so a conflict shows up as soon as you run the script rather than as puzzling behaviour on the bench.