Linux Application layer directly operates GPIO

Source: Internet
Author: User

Linux Application layer directly operates GPIO

Under the guidance of an expert, the application layer can operate the GPIO directly, which refers to setting the input and output of the GPIO and the high or low output level. This greatly improves flexibility, the official documentation has GPIO Sysfs Interface for Userspace,gpio Sysfs.

Here I take a look at the examples used:

# RK30_PIN0_PD4# A0-7 -> 0-7 / B0-7 -> 8-15 / C0-7 -> 16-23 / D0-7 -> 24-31echo 28 > /sys/class/gpio/exportecho "out" > /sys/class/gpio/gpio28/directionecho 1 > /sys/class/gpio/gpio28/value
    • 1
    • 2
    • 3
    • 4
    • 5

The code above is set to RK30_PIN0_PD4 output and the output level is set to high.

OTG's PIN pin is RK30_PIN3_PD5 .

It's good to have an old finger, before I imagined there was no way to control the input/output of the Gpio directly at the user level and set the output level, but eventually there was no result.

The background of this problem is the USB host Port power control on the motherboard, when porting the latest kernel version to the motherboard, the USB port does not have the power output, the manual enable power supply solves the problem. This is manual control, which you will add to the DTS file later.

Linux Application layer directly operates GPIO

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.