Hi,
I was trying to follow the example in the man page GPIO(3lua)
, while trying to run the code I can see the number of PINs (32) of my SBC (Iconikal Rockchip RK3328 SBC A53 64-Bit Processor). However, when the code reaches the gpio.read()
function it gives me the error: lua: GPIOREAD
.
This is the code I'm using:
local gpio = require 'gpio'
gpiodev = gpio.open('/dev/gpio0')
local pins = gpio.info(gpiodev)
for n = 1, pins do
print('pin ' .. n .. ': ' .. gpio.read(gpiodev, n))
end
gpio.close(gpiodev)
The result:
user@localhost > doas lua ./gpio.lua
lua: GPIOREAD
stack traceback:
[C]: in function 'gpio.read'
./gpio.lua:6: in main chunk
[C]: in ?
Does anybody knows if I'm doing something wrong? Or what might be the problem?
I don't know if this is useful:
user@localhost > dmesg | grep gpio
[ 1.000004] rkgpio0 at rkiomux0: GPIO (gpio0@ff210000)
[ 1.000004] gpio0 at rkgpio0: 32 pins
[ 1.000004] rkgpio1 at rkiomux0: GPIO (gpio1@ff220000)
[ 1.000004] gpio1 at rkgpio1: 32 pins
[ 1.000004] rkgpio2 at rkiomux0: GPIO (gpio2@ff230000)
[ 1.000004] gpio2 at rkgpio2: 32 pins
[ 1.000004] rkgpio3 at rkiomux0: GPIO (gpio3@ff240000)
[ 1.000004] gpio3 at rkgpio3: 32 pins
[ 1.000004] /syscon@ff100000/gpio at syscon0 not configured
[ 1.000004] gpioleds0 at simplebus0: