User Tools

Site Tools

Translations of this page:
en

en:bpi-r64:gpio

GPIO

pin-define

2nd function main function pin# xxxxxxxxxxxxxxxxxxxxx pin# main function 2nd function
+3V3 1 2 +5V
GPIO 56 # I2C1_SDA 3 4 +5V
GPIO 55 # I2C1_SCL 5 6 GND
GPIO101 PWM 7 7 8 UART0-TX GPIO 59 #
GND 9 10 UART0-RX GPIO 60 #
GPIO 51 # PWM1 / UART1-TX 11 12
GPIO 52 # PWM2 / UART1-RX 13 14 GND
GPIO 98 # 15 16 GPIO 61 #
+3V3 17 18 GPIO 62 #
GPIO 68 # PWM5 / SPI1 MOSI 19 20 GND
GPIO 69 PWM6 / SPI1 MISO 21 22 SPI0 CLK GPIO 63
GPIO 67 PWM4 / SPI1 CLK 23 24 SPI1 CS GPIO 70
GND 25 26 SPI0 CS GPIO 66
GPIO 58 I2C2 SDA 27 28 I2C2 SCL GPIO 57
GPIO 85 29 30 GND
GPIO 82 SPI0 MOSI 31 32 SPI0 MOSI GPIO 64
33 34 GND
35 36 SPI0 MISO GPIO 65
GPIO 86 37 38 I2S IN
GND 39 40 I2S OUT

(# verified gpio working, 101 is blocked by pwm)

  • uart0 (dts) ⇒ Debug-Uart
  • uart1 (dts) ⇒ undefined ⇒ mt7622_uart2_2_tx_rx_pins (59/60)
  • uart2 (dts) ⇒ uart1 (gpio) ⇒ mt7622_uart2_1_tx_rx_pins (51/52)

Kernel 4.19

root@bpi-iot-ros-ai:~# cat /sys/kernel/debug/pinctrl/10211000.pinctrl-pinctrl_mt7622/gpio-ranges
GPIO ranges handled:
0: pinctrl_mt7622 GPIOS [409 - 511] PINS [0 - 102]
root@bpi-iot-ros-ai:~# GPIO_NO=$((409+56))
root@bpi-iot-ros-ai:~# echo $GPIO_NO
465
root@bpi-iot-ros-ai:~# echo $GPIO_NO > /sys/class/gpio/export

-bash: echo: write error: Invalid argument => blocked by i2c1

#if i2c1 is disabled in dts:
root@bpi-r64:~# echo $GPIO_NO > /sys/class/gpio/export                          
root@bpi-r64:~# echo out > /sys/class/gpio/gpio${GPIO_NO}/direction             
root@bpi-r64:~# echo 1 > /sys/class/gpio/gpio${GPIO_NO}/value #led goes on
root@bpi-r64:~# echo 0 > /sys/class/gpio/gpio${GPIO_NO}/value #led goes off

The sysfs interface (/sys/class/gpio/…) needs kernel-option CONFIG_GPIO_SYSFS

uart

debug-Uart is uart0 in DTS, uart2 seems to be uart1 of gpio header…uart1 is currently not defined in dts.

on-board LEDs

needs LEDS_GPIO [=y]

there is only red and green, red seems not working

  echo 1 > /sys/class/leds/bpi-r64\:pio\:green/brightness

Discussion

en/bpi-r64/gpio.txt · Last modified: 2019/11/26 19:28 by frank