Skip to content

Pinout_UPXi11

Teteh Camillus Chinaedu edited this page Oct 6, 2022 · 20 revisions

Pinout


Warning: Pin Linux number for I2C devices depend on kernel configuration. To check your bus numbering go to I2C Ports


NOTE: Please note that ADC is currently not working due to kernel regression (future kernel releases will fix the issue).


Accessing the peripherals on the UP Xtreme

GPIO

On UP Xtreme at the system start, all the pins in the hat connector are configured in function mode.

So for example the hat pin 3 associated with I2C_SDA function at the start is configured as an I2C channel

You can switch the function after booting accessing the gpio pin using linux sysfs gpio interface. For example the following commands will blink an led connected to pin 13 :

 $ sudo -i
 $ cd /sys/class/gpio
 $ echo 27 > export
 $ cd gpio27
 $ echo "out" > direction
 $ watch -n 0.5 'echo 1 > value; sleep 0.5 ; echo 0 > value'

after finishing to use the GPIO we need to unexport it.

 $ echo "in" > direction
 $ cd ..
 $ echo 27 > unexport

Warning: The current pinctrl driver implementation does not allow to restore a pin in function mode (e.g. UART) once it has been already switched to GPIO mode until the operating system is rebooted.

Warning: When a pin is unexported it retains the last value/direction. So if you don't intend to use the GPIO again better set it to input to protect it from short/electrical problems.


The GPIO could also be accessed with RPi numbering so for example we can have done the same example with

 $ sudo -i
 $ cd /sys/class/gpio
 $ echo 27 > export
 $ cd gpio27
 $ echo "out" > direction
 $ watch -n 0.5 'echo 1 > value; sleep 0.5 ; echo 0 > value'
 $ echo "in" > direction
 $ cd ..
 $ echo 27 > unexport

Of course, you cannot use a different numbering scheme on the same pin at the same time.

Interrupts

Currently interrupts are only supported using the Linux GPIO numbering scheme (e.g. use 432 GPIO number instead of Rpi GPIO number 27).

The most simple way to use interrupts from userspace is to use a userspace software library like mraa

Example IRQ test using Python Periphery

  1. Download this file and extract it on the board

  2. install python3-pip

sudo apt update && sudo apt install python3-pip

  1. install periphery from pip

sudo -H pip3 install python-periphery

  1. launch the script

sudo python3 irqtest.py

UART

To identify the TTY device node number in Linux corresponding to a particular hardware UART open a terminal and execute the following command

 $ ls /sys/bus/pci/devices/0000\:00\:*/dw-apb-uart*/tty/ | grep tty
 
 
/sys/bus/pci/devices/0000:00:19.2/dw-apb-uart.5/tty/:
ttyS4
/sys/bus/pci/devices/0000:00:1e.0/dw-apb-uart.6/tty/:
ttyS5

The ttyS5 UART (associated to dw-apb-uart.6) is the UART on the HAT connector. The UART ttyS4 associated with dw-apb-uart.5 is a UART on CN11

So to access the UART on the HAT on linux I have to open the device file '''/devttyS5'''

sudo screen /dev/ttyS5 115200

The tty device nodes for COM1 and COM2 are:

CN28 - 	/dev/ttyUSB0
CN29 -  /dev/ttyUSB1

I2C ports

Similar to UART ports above, I2C device nodes in Linux can be identified as follows:

  • i2c_designware.2 -> I2C channel on hat (pin 27,28 ID_SD ID_SCL)
 ls /sys/bus/pci/devices/0000\:00\:15.3/i2c_designware*/ | grep i2c
 i2c-4
  • i2c_designware.3 -> I2C channel on hat (pin 3,5 on HAT)
 ls /sys/bus/pci/devices/0000\:00\:19.0/i2c_designware*/ | grep i2c
 i2c-5

So the Linux device node for the first i2c channel is /dev/i2c-4

To detect all the peripherals on the first i2c bus do the following

 $ sudo apt install i2c-tools
 $ sudo i2cdetect -y -r 4

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- 54 -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

SPI

Installing ACPI overrides to enable SPI in userspace

By default, no SPI device is created for user access by default. To enable access to SPI from userspace you should add an ACPI override on the kernel

  1. Download this zip file and uncompress it:
  2. Enter in the extracted directory and type in a terminal:
   $ chmod +x acpi-add acpi-upgrades install_hooks
   $ sudo ./install_hooks && sudo acpi-add spidev*
  1. Reboot the system

now you should see the spi devices under /dev $ ls /dev/spi* /dev/spidev0.0 /dev/spidev0.1

LEDs

The UP Xtreme includes 3 LEDs (0, 1 and 2) on the underside of the board, which are controlled by the pin control CPLD on the board. As root, you can use the following commands to control the LEDs:

 # Turn on LED 0 (yellow)
 echo 1 > /sys/class/leds/led\:0\:/brightness
 # Turn off LED 0
 echo 0 > /sys/class/leds/led\:0\:/brightness

For other LEDs, replace "0" with "1" or "2" in the commands above.

Advanced Audio Mode

Under HAT configuration the user can select Advanced Audio Mode which will disable the standard 40pin functionalities and enable additional Audio features.

Please be aware that the Header voltage Level in Advanced Audio Mode is also switched to 1.8V except for the 3.3 and 5V power pins.

Advanced Audio Mode comes with 3 preconfigured settings for the pins which are the following:

AAM Config 1

Only the Soundwire protocol pins (4 Soundwire interfaces) are enabled and configured with the following functionalities

Pin Mode Pin Direction/Option available HAT Pin Number
SNDW3_DATA bidirectional 8
SNDW1_CLK output 10
I2S_MCLK or disabled if possible 16
SNDW0_DATA bidirectional 18
SNDW2_DATA bidirectional 22
SNDW1_DATA bidirectional 24
SNDW3_CLK output 26
SNDW2_CLK output 28
SNDW0_CLK output 32

AAM Config 2

Soundwire and DMIC pins are enabled: 2 Soundwire and 2 DMIC

Pin Mode Pin Direction/Option available HAT Pin Number
DMIC_DATA0 input 8
SNDW1_CLK output 10
I2S_MCLK or disabled if possible 16
SNDW0_DATA bidirectional 18
DMIC_DATA1 input 22
SNDW1_DATA bidirectional 24
DMIC_CLK0 output 26
DMIC_CLK1 output 28
SNDW0_CLK output 32

AAM Config 3 (Not Available)

Soundwire, DMIC and I2S are enabled: 1 Soundwire, 1 DMIC and 1 I2S

Pin Mode Pin Direction/Option available HAT Pin Number
8
10
16
18
22
24
26
28
32
Clone this wiki locally