Testing Rockchip GPIO's from Ubuntu

Hi, is it possible to test the rockchip GPIO’s from Linux? Do you have a reference code or something for it?

To Configure GPIO Pins

To configure you need root permission.
Run su command in teminal and enter root password.
Vicharak Board Root password is root

  1. Here, you can find SOC GPIOs Header pins for Vaaman RK3399 Processor.
    Vaaman GPIO Description | Vicharak

  2. The GPIOs are typically accessible in /sys/class/gpio folder.
    Each GPIO Pins have folder named as gpio<GPIO_NUMBER>.
    Example : GPIO PIN 40 => gpio135 for GPIO4_A7

    You need root permission to configure it, Make sure you’re in root User.
    by running command sudo su then, enter the root password OR you can run below commands using sudo.

    If the folder is not present, the GPIO needs to be exported first.

    echo 135 > /sys/class/gpio/export

    Similarly, you can also unexport it -

    echo 135 > /sys/class/gpio/unexport

  3. To read the value of GPIO number 135, need to first set the gpio as an output

    echo out > /sys/class/gpio/gpio135/direction

    Similarly, you can set gpio as an input

    echo in > /sys/class/gpio/gpio135/direction

  4. Read the value by

    cat /sys/class/gpio/gpio135/value

  • To set GPIO4_D5 as low

    echo 0 > /sys/class/gpio/gpio135/value

  • To set GPIO4_D5 as high

    echo 1 > /sys/class/gpio/gpio135/value

Or in simpler way, you can do this way,

sudo apt install libgpiod-dev
sudo gpioset gpiochipX <gpio_num>=value
sudo gpioget gpiochipX <gpio_num>

You can get more info by,

sudo gpioinfo

Hi, I tried using ‘sudo gpioinfo’ but I could see gpiochip0 to gpio4. Which one do I use?

Can you tell me which pin you want to use @robowizard from the Vaaman GPIO Description | Vicharak

I want to try using one of these:

image

Is this not the right pinmap?

You right both of them are same only!

Let’s assume you want to make GPIO4_D2 high, then

sudo gpioset gpiochip4 26=1 # 1 for making it high

Here, 26 number is calculated as follows,
A0-A7 → 0-7
B0-B7 → 8-15
C0-C7 → 16-23
D0-D7 → 24-31

Same for the making it low,

sudo gpioset gpiochip4 26=0 # 0 for making it low