New Version for newer versions of Linux (3.8.x)
In this video I am going to continue my series on the Beaglebone by demonstrating how to use its GPIOs for both input and output applications. In this video I will wire simple input and output circuits that are attached to two GPIOs – one that lights an LED and the other that receives a button input. I covered this topic below before in a previous video. I am updating it here because there have been significant changes to the Linux kernel. This video will cover the Linux device tree for ARM embedded systems and explain how you can create custom device tree overlays to configure the GPIOs for your applications at run time from within the Linux userspace. I will explain the use of internal and external pullup and pulldown resistors and I will make available and describe a set of C++ code examples for reading and writing to the Beaglebone’s GPIOs. I have also built a set of PDF tables that aggregate the information that you need and make it easier to configure GPIOs on your Beaglebone’s P8 and P9 headers.
[youtube id=”wui_wU1AeQc” width=”600″ height=”350″]
The code for the new version of this video is available using:
1 |
git clone git://github.com/derekmolloy/boneDeviceTree/ |
The two PDF documents listed in this video are available below (P8 and P9 Headers):
Press on the image and then press “view raw” to view the PDF files. These are available in the docs directory of the github repository above.
There is more information in this content available in my blog post at: http://derekmolloy.ie/gpios-on-the-beaglebone-black-using-device-tree-overlays/
Old Version for older versions of Linux (<3.8)
In this video I extend my series on introducing the Beaglebone and developing applications using embedded Linux to demonstrate how we can build an application that uses its GPIOs (General Purpose Input/Outputs). The example demonstrates a simple LED output circuit and a simple pushbutton input circuit that we can connect to the Beaglebone GPIOs directly. I then go through the steps on how we can configure and access these GPIOs using Sysfs in embedded linux and then demonstrate how we can write a C/C++ program that works directly with these pins. Finally I demonstrate how we can use polling to wait for a GPIO input such as a button press or key press. This application is relevant to all flavours of embedded Linux.
[youtube id=”SaIpz00lE84″ width=”600″ height=”350″]
The code that the final application is based on is available at: https://www.ridgerun.com/developer/wiki/index.php/Gpio-int-test.c
The source code in this video is available through githhub:
1 |
git clone git://github.com/derekmolloy/beaglebone |
The 4,500 page document that I mention 15 minutes in is available for download from Texas Instruments’ Website. It is called “AM335x ARM(r) Cortex(TM)-A8 Microprocessors(MPUs)”. The version I have is “Literature Number: SPRUH73C” from Oct’11(revised Dec’11).