en:bpi-r2pro:gpio
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:bpi-r2pro:gpio [2022/01/15 11:56] – [GPIO] frank | en:bpi-r2pro:gpio [2023/06/08 17:06] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== GPIO ====== | ||
+ | {{ : | ||
+ | |||
+ | ^ Sparefunction ^ Mainfunction ^ pin# ^ xxxxxxxxxxxxxxxxxxxxx ^ pin# ^ Mainfunction | ||
+ | | | | | {{ : | ||
+ | | - | 3V3 | ||
+ | | I2C5_SDA M0 | GPIO3 B4 (12) | ||
+ | | I2C5 SCL M0 | GPIO3 B3 (11) | | ||
+ | | PWM10 | GPIO3 B5 (13) | | ||
+ | | - | GND | ||
+ | | UART7 TX | GPIO3 C4 (20) | 11 | ::: | 12 | GPIO4 D2 (26) | | | ||
+ | | UART7 RX | GPIO3 C5 (21) | 13 | ::: | 14 | GND | - | | ||
+ | | PWM11 | GPIO3 B6 (14) | 15 | ::: | 16 | GPIO0 C4 (20) | UART0 RTS | | ||
+ | | - | 3V3 | ||
+ | | SPI3_MO, PWM15 | GPIO4 C3 (19) | 19 | ::: | 20 | GND | - | | ||
+ | | SPI3_MI, PWM12, UART9 TX | GPIO4 C5 (21) | 21 | ::: | 22 | GPIO4 C4 (20) | SPDIF TX | | ||
+ | | SPI3_CK, PWM14 | GPIO4 C2 (18) | 23 | ::: | 24 | GPIO4 C6 (22) | PWM13, UART9 RX | | ||
+ | | - | GND | ||
+ | | | GPIO1 A4 (4) | 27 | ::: | 28 | GPIO3 C1 (17) | | | ||
+ | | | GPIO1 B0 (8) | 29 | ::: | 30 | GND | - | | ||
+ | | | GPIO1 B1 (9) | 31 | ::: | 32 | GPIO3 A7 (7) | ||
+ | | | GPIO1 B2 (10) | 33 | ::: | 34 | GND | - | | ||
+ | | | GPIO0 A0 (0) | 35 | ::: | 36 | GPIO3 A2 (2) | ||
+ | | | GPIO2 D6 (30) | 37 | ::: | 38 | GPIO0 A6 (6) | ||
+ | | - | GND | ||
+ | | | | | ::: | | | | | ||
+ | |||
+ | |||
+ | There are four gpio controllers (gpio0-3) with four banks (A-D) of 8 gpios each (0-7). | ||
+ | |||
+ | https:// | ||
+ | |||
+ | PWM 10-15 / UART 0+7+9 / I2C5 / SPI3 have to be enabled in dts | ||
+ | ===== gpiolib ===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | apt install gpiod | ||
+ | |||
+ | Gpioset only sets gpio while running, so run with wait and press ctrl+z to stop process (running bg will end it and reset gpio) | ||
+ | |||
+ | This will set gpio 6 on first controller (0): | ||
+ | |||
+ | # gpioset -m wait 0 6=1 | ||
+ | ^Z[1]+ | ||
+ | |||
+ | ===== pwm ===== | ||
+ | |||
+ | [[..: | ||
+ | |||
+ | each pwm enabled gets its own pwmchip-node where it can be enabled with "echo 0" | ||
+ | |||
+ | if the pwms of fan (8) and all on gpio header enabled (10-15) we get / | ||
+ | |||
+ | example for pwm10 (pin 7) with 1 Hz blinking (values for period and duty_cycle in ns) | ||
+ | |||
+ | # echo 0 > / | ||
+ | # echo 1000000000 > / | ||
+ | # echo 500000000 > / | ||
+ | # echo 1 > / | ||
+ | |||
+ | ===== thermal ===== | ||
+ | |||
+ | root@bpi-r2pro: | ||
+ | cpu-thermal | ||
+ | root@bpi-r2pro: | ||
+ | 43125 | ||
+ | root@bpi-r2pro: | ||
+ | gpu-thermal | ||
+ | root@bpi-r2pro: | ||
+ | 43750 | ||
+ | ===== saradc ===== | ||
+ | |||
+ | cat / |