Node.js on Khadas VIM

You can follow below step to read / write the GPIO

Steps

1). You need to reconfigure the kvim_defconfig in kernel

++   CONFIG_GPIO_DEVRES=y
++   CONFIG_GPIOLIB=y
++   CONFIG_OF_GPIO=y

2). The VIM GPIO port number list

	 GPIOH5:     176
	 GPIOH6:     177
	 GPIOH7:     178
	 GPIOH8:     179
	 GPIOH9:     180
    GPIOAO6:     151

3). Write / Read the GPIO

eg: config the GPIOH5 as high level output
echo  176 > /sys/class/gpio/export
echo  out  > /sys/class/gpio/gpio176/direction
echo  1    > /sys/class/gpio/gpio176/value

eg: config the GPIOH5 as input
echo  176 > /sys/class/gpio/export
echo  in  > /sys/class/gpio/gpio176/direction

2 Likes