Control GPIO using the new Linux user space GPIO API

From the version 4.8, the Linux kernel introduces a new user space API based on character devices for managing and controlling GPIOs ( General-Purpose Input/Output). This post presents the basic of the new interface as well as a simple tutorial/example to demonstrate how to use the new API to control GPIOs.

The hardware used in the tutorial is the Raspberry Pi 3B but the code is generic and can be used on any embedded hardware.

25/02/2018 LPC1114FN28, ARM, GPIO, interrupt

Arm-cortex m0 programming with LPC1114FN28 , a guild to GPIOs

This is a migrated version of my Wordpress post, written on : 14 Mars 2015

Input/Output

The LPC1114FN28 has two pin ports (0 and 1) that make totally 22 pins (12 for port 0 and 10 for port 1, as shown in the image below). All of these pins could be used as GPIOs. By default, they are all input and pull up-enable (that is each pin is connected to an internal pull-up resistor) except for PIO0_5 (dp5) and PIO04 (dp27) which are "open-drain" (a transistor connects to low and nothing else). Their functionalities can be configured easily by software.

The figure below shows the pin out of the chip, note that each PIOn_m refers to the pin m on the port n.

Powered by antd server, (c) 2017 - 2024 Dany LE.This site does not use cookie, but some third-party contents (e.g. Youtube, Twitter) may do.