Toggling an LED on Pandaboard using GPIO

From OMAPpedia

Jump to: navigation, search


[edit] Abstract

In this guide, I will describe how to toggle an LED using the GPIO on Pandboard step by step. This guide targets beginners who are just getting started on the Pandaboard.

[edit] Prerequisites

[edit] GPIO on the Pandaboard

Please download the Pandaboard reference manual from here:reference manual

There are two expansion headers J3 and J6 which contain the GPIO(s). I have used the J6 expansion header.So, how are the pins numbered? For this look at figure-1 below:


Figure-1: Expansion Headers on the Pandaboard

The numbering is same for both the headers. Let us take the J6 header. The top row of J6 header will contain odd numbered pins while the bottom row will contain the even numbered pins. The first pin on the top row(enclosed within a rectangle in the above figure) will always be Pin-1. Now, if you go refer pages 42-44 of the above manual, you will get more information about the different GPIO available on the pandaboard. Now let us refer table-11 on Page 44. This table explains the numbering of the pins on the expansion header J6 and the primary as well as secondary function of each pin on it. So, we know that pin-7 on J6 is the digital ground and pin-9 on J6 can also be used as GPIO. Pin-9 uses GPIO-38.

[edit] Steps

$ grep GPIOLIB /boot/config-`uname -r`

The output after running the above command should be as shown below:


Now run the following command in the terminal:

$ grep GPIO_SYSFS /boot/config-`uname -r`

The output after running the above command should be as shown below:


Write the following commands in your terminal:

$ sudo su 
$ cd /sys/class/gpio 
$ echo 38 > export 
$ cd gpio38
$ echo "high" > direction

You should get the output as shown below:


Figure-2: Led OFF


Figure-3: Led ON

[edit] Headline text



Personal tools