Control gpio bpi r64

hi everyone, i’m a newbie. I have a bpi r64 and want to research about gpio pins. easy example : control leds. i installed linux in Bpi and want to control passed interface /sys/class/gpio.I guess that output GPIO is 5 V. So, I connected GPIO 22 -> resistor (330 Ohm) -> (+) led -> (-) led -> GND (in GPIO 20). Now, i perform :

  1. echo 431 (22 + base GPIO409 ) > export
  2. cd /gpio431 3 . echo out > direction
  3. echo 1 > value Why doesn’t my leds light ? What step am i failed ? Or What things i understand wrong ? sorry and tks everyone :wink:

You will find some examples here

Tks bro. I performed same your step. It’s dark. I see you write that : “The sysfs interface (/sys/class/gpio/…) needs kernel-option CONFIG_GPIO_SYSFS”. I think my problem doesn’t config. How to check status config or how to config ? Tks you.

You said that : the output of GPIO is 3.3V?. Should i uninstall Resister

I guessed that,but maybe it’s 5v…have not found time to measure it

If you use my kernel (e.g.5.4) all options should be enabled. The error is an example for other kernels as hint

You can use zgrep pattern /proc/config.gz after loading configs module

You add 22…which gpio do you want to control? Pin-number is not gpio number…see table in my wiki (all gpio with numbers above 50). Pin 22 = gpio 63…here you need to check if spi0 is disabled (in devicetree) or you will get error, on blocked gpio

cat /sys/firmware/devicetree/base/spi\@1100a000/status

if this prints “okay” you need to disable spi0 in

you need to use your kernel/branch and recompile…

Easier would be using a gpio not blocked by an other function (e.g. pin16/18)

And no: do not use a led without resistor…it limits current…

yeah, thanks to support. i try to test GPIO with : Getting Started with R64 - Banana Pi Wiki ( . their example : control GPIO 22 by : plus with GPIO base (GPIO409 ) . tks u. tomorrow I will try your way. Thank u so much.

i’m doing with Ubuntu 18.04 kernel 5.4

You were right. it prints “okay” . i understand that edit “disable” and recompile. How to recompile ? tks u so much.

Which image (my ubuntu or bpi) do you use and which exact kernel (uname -a)?

As i said before try an gpio not blocked by other driver and use gpio-number instead of pin

yes . i try and the led is light. u were right. i using ubuntu .i understand my gpio is blocked and i need disable SPI mode in GPIO 63.

Maybe you can blacklist spi driver,but i do not know config of offical kernel

do you have a detailed beginner’s guide how to disable SPI or build kernel ?

You can try my kernel

Clone it

Change build.conf to r64 (i guess official image uses legacy way so only change board)

install depencies and use to build/install to sdcard (not fit), add kernel/fdt entry to uenv.txt

as legacy way has separate dtb and you only change dtb it is maybe easier to replace only dtb

seems to be official source for kernel 5.4 for r64…there is a, you need to compile full kernel (as dtb is done while compile kernel), but only replace dtb

alternatively you can use my debian-image and compile my kernel, as it is up-to-date

This image uses new way (fit) here you need to enable arch too in build.conf and install fit

1 Like