OK3568 4.19.206 Buildroot Controlling GPIO Pins via Sysfs in C Language

Document classification: □ Top secret □ Secret □ Internal information ■ Open

Revision History

Date

Version

Revision History

04/08/2022

V1.0

Initial Version

Controlling GPIO Pins via Sysfs in C Language

1. Write GPIO control program, reference source files can be found in the folder:

gpiotest-read(gpio3_a5)

gpiotest-write(gpio3_b0)

2. Import environment variables (set the red font part according to the specific path):

export PATH=$PATH:/home/forlinx/ubuntu-/OK3568-linux-source/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin

3. Compile the gpiotest-write.c file

aarch64-linux-gnu-gcc -o gpiotest gpiotest-write.c

4. Copy the gpiotest executable file to the development board to run

5. You can see that the green LED lights are on and off at intervals of 1 second.