-
Notifications
You must be signed in to change notification settings - Fork 11
Pinout_UP6000
Warning: Pin Linux number for I2C devices depend on kernel configuration. To check your bus numbering go to I2C Ports
On UP Squared 6000 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 216 > export
$ cd gpio216
$ 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 216 > 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.
Currently interrupts are only supported using the Linux GPIO numbering scheme (e.g. use 216 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
- Download this file and extract it on the board
- install python3-pip
sudo apt update && sudo apt install python3-pip
- install periphery from pip
sudo -H pip3 install python-periphery
- launch the script
sudo python3 irqtest.py
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.7/tty/:
ttyS4
/sys/bus/pci/devices/0000:00:1e.1/dw-apb-uart.9/tty/:
ttyS6
The first UART (associated to dw-apb-uart.7) is the uart on the debug console port, and the one associated with dw-apb-uart.9 is the one on the HAT.
So to access the UART on the HAT you have to open the device file '''/dev/ttyS6'''
sudo screen /dev/ttyS6 115200
Similar to UART ports above, I2C device nodes in Linux can be identified as follows:
- i2c_designware.0 -> I2C channel 0 on hat (ID_SD ID_SCL)
ls /sys/bus/pci/devices/*/i2c_designware.0/ | grep i2c
i2c-2
- i2c_designware.1 -> I2C channel 0 on hat (pin 3,5 on HAT)
ls /sys/bus/pci/devices/*/i2c_designware.1/ | grep i2c
i2c-4
So the Linux device node for the first i2c channel is /dev/i2c-2
To detect all the peripherals on the first i2c bus do the following
$ sudo apt install i2c-tools
$ sudo i2cdetect -y -r 0
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- 61 -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
SPI device nodes in Linux can be identified as follows:
ls /sys/bus/pci/devices/0000\:00\:*/pxa2xx-spi.*/spi_master/ | grep spi
/sys/bus/pci/devices/0000:00:1e.2/pxa2xx-spi.10/spi_master/:
spi1
/sys/bus/pci/devices/0000:00:1e.3/pxa2xx-spi.11/spi_master/:
spi2
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
- Download this zip file and uncompress it.
- 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*
- Reboot the system
Now you should see the SPI devices under /dev
$ ls /dev/spi*
/dev/spidev2.0 /dev/spidev2.1
The UP Squared 6000 includes 4 LEDs (0, 1, 2, and 3) on the underside of the board (underneath Ethernet dual port), which are controlled by the pin control FPGA on the board. As root, you can use the following commands to control the LEDs:
# Turn on the LED 0
echo 1 > /sys/class/leds/led\:0\:/brightness
# Turn off the LED 0
echo 0 > /sys/class/leds/led\:0\:/brightness
For other LEDs, replace "0" with "1", "2" or "3" in the commands above.
To enable the device mode you will need to update the default BIOS settings by doing the following:
- Boot into BIOS >> Advanced >> USB Configuration
- xDCI support to [Enabled]
- USB Device/HOST Mode Override to [Select-Per-Pin]
- USB HS0 Operation Mode to [USB Device Mode]
- Boot into BIOS and login as admin using password: upassw0rd
- Enter BIOS setup menu
- Move to 4th sheet Security
- Select Secure Boot and Press ENTER
- Select Key Management and press ENTER
- Check your settings / required conditions in key management. For example change Factory Key Provision from [Disabled] to [Enabled]
- Go back to Secure Boot page, select [Disabled], ENTER, [Enabled], ENTER
- Download and installed DediProg SF software here https://www.dediprog.com/download/save/1216.msi, SF7.3.57.27.msi
- Connect the SF100 programmer to your PC through USB port
- Check whether the DediProg SF Programmer driver is displayed under Universal Serial Bus controllers in Device Manager.
- If “DediProg SF Programmer driver” does not show up, please check your SF100 connection or driver installation.
- If the driver is ready and no yellow exclamation mark on DediProg in device manager. Please use one of our BIOS cable (1701140271) to connect from the SF100 (ISP connect) to EHL board
- Double click the “DediProg Engineering” icon on your desktop
- If the connecting EHL board is correct, you will see the message below on the DediProg software, so please choose the memory type to W25Q256JW. If you don't see the Memory Type Ambiguity message, please check connection for BIOS cable in both side.
- The message below will display after setting the memory type.
- To load BIOS bin file, click on the "File" icon in the top of the window, and click on “find” then select and upload the bin file.
- The message below will display after loading the BIOS bin file.
- To flash BIOS, just click on the "Batch" icon in the top of the window and wait for its processing to be finished as shown in the message below.
NOTE: This wiki is the main source of documentation for developers working with (or contributing to) the UP products. If this is your first time hearing about UP, we recommend starting with our main UP website, and our UP community page.