Linux Device-Tree and gpio-keys driver on BeagleBone Black

I had to wire up a simple navigation keypad to a BeagleBone Black for a prototype, and I used the gpio-keys driver configured via a device tree overlay.

I looked for some free GPIO pins so that the keypad could be hooked up with minimal changes to the BeagleBone Black default configuration.

I am posting some details in case anyone (future-self included) needed to do the same.

Here is a table of the pins and the related keys.

Header PinFunction
P8_07Up
P8_08Left
P8_09Right
P8_10Down
P8_26Enter
P9_15Esc

I did not use P8_11 and P8_12 because they can be configured in eQEP mode and I intended to use them for a rotary encoder.

Here is a picture of how the keypad can be hooked up using a breadboard.

Navigation keypad with BeagleBone Black

And a quick video to show the functionality:

The devicetree overlay can be found at git.ao2.it/experiments/bbb-gpio-keypad.git/ and can be built and installed by running make && sudo make install, after getting the needed include files as explained in the Makefile.

Nowadays, devicetree overlays on the BeagleBone Black have to be set via the bootloader by changing the file /boot/uEnv.txt, in this case the following change was enough:

--- /boot/uEnv.txt.orig	2018-07-13 13:28:12.837315343 +0000
+++ /boot/uEnv.txt	2018-07-13 13:27:59.525770867 +0000
@@ -11,7 +11,7 @@ uname_r=4.9.105-ti-r112
 enable_uboot_overlays=1
 ###
 ###Overide capes with eeprom
-#uboot_overlay_addr0=/lib/firmware/<file0>.dtbo
+uboot_overlay_addr0=/lib/firmware/bbb-gpio-keypad-00A0.dtbo
 #uboot_overlay_addr1=/lib/firmware/<file1>.dtbo
 #uboot_overlay_addr2=/lib/firmware/<file2>.dtbo
 #uboot_overlay_addr3=/lib/firmware/<file3>.dtbo

CommentiCondividi contenuti

This has been a huge help.

Ritratto di DHX664

This has been a huge help. Thank you for providing your work to the community.

Invia nuovo commento

Il contenuto di questo campo è privato e non verrà mostrato pubblicamente. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Indirizzi web o e-mail vengono trasformati in link automaticamente
  • Elementi HTML permessi: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Linee e paragrafi vanno a capo automaticamente.

Ulteriori informazioni sulle opzioni di formattazione

CAPTCHA
Questa domanda serve a verificare che il form non venga inviato da procedure automatizzate
F
g
s
7
U
x
Enter the code without spaces.