BeagleBone Black – playing with I/O

Tuesday hacking evening is tonight to get start with BeagleBone as my RPI is not available for the project I have in mind. So the objective today is to get a LED blinking on BBB board.

Read the full article for details

Some hardware considerations

So first step is to get hardware documentation to have informations about the expansion ports. Here is what we have in the documentation:

beaglebone black P8/P9 connectors

beaglebone black P8/P9 connectors


We have two expansion connector P8 and P9 as displayed on this capture from the main documentation. The Pin number are visible on the PCB. One is alway top left here.











The pin-out for P8 and P9 are the following :

beagle bone black P9 pin-out

beagle bone black P9 pin-out

beagle bone black P8 pin-out

beagle bone black P8 pin-out





















On P9, Pin 1/2 and 43-46 are GND, 3/4 are 3.3V, 5/6 are 5V

On P8, Pin 1/2 are GND

To get access to the GPIO, (according to this site) you need to go to /sys/class/gpio directory

Then, we find gpiochip0, gpiochip32 … gpiochip0 correspond to gpio1_xx in the pinout, gpiochip32 to pgio2_xx … So to get the right entry in the filesystem for gpio1_28 (pin 12), you should look for 32*1+28 = 60.

To be accessible, the gpio have to be configured by writing its number in /sys/class/gpio/export. this will create a new entry in /sys/class/gpio with the gpio number. This entry is a directory where you can configure & access the gpio.

In the gpioxx directory, you can, now, write in the direction file some keyword:

  • in : will configure it as an input
  • out : will configure it as an output
  • high : will configure as an output set to high (no glitch)
  • low : will configure as an output set to low (no glitch)

You can then write 0 / 1 in the value file to modify the value.


To make a led blinking :

Make a led blinking

Make a led blinking

Connect anode to +3.3V, the cathode to 10K resistor, then to Pin12 for GPIO 1_28 (gpio60).

In the system run the following commands :

#cd /sys/class/gpio
#echo 60 > export
#cd gpio60
#echo low > direction
#while true ; do echo 1 > value ; sleep 1 ; echo 0 > value ; sleep 1 ; done

Hope it helps !

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.