Skip navigation
1 2 Previous Next

BeagleBoard

23 Posts authored by: Drew Fustini

tuxbbbluv.png

After my last post Build fbtft drivers for Linux 4.4 on BeagleBone Black, I was curious what patches are needed to run mainline Linux kernel on BeagleBoard.  Here's what I've found so far:

 

Mainline Linux kernel

 

Robert C. Nelson's bb-kernel repo

"This git repo contains just scripts/patches to build a specific kernel for some ARM devices. The kernel source will be downloaded when you run any of the build scripts"

 

Patchset for BeagleBone:

 

BeagleBone Cape Manager (bone_capemgr):


Workaround: Disable DMA for SPI driver:

 

Related GitHub Gists:

Chicago hackerspace Pumping Station: One uses BeagleBoard to control door access:

door.jpg

 

There is BeagleBone Black on the Front Door and the Back Door:

door2.jpg

door3.jpg

 

The BeagleBone is a connected to a Sparkfun USB RFID breakout with a ID-12 RFID Reader.  This scans the RFID keys:

rfid.jpg

[More photos]

 

PS1 president Derek Bever and other members are collaborating on this GitHub repo:

 

Client-side RFID authentication (and general access control)

This system is built on a BeagleBone Black and Sparkfun's USB board for RFID readers for hardware, and PS1Auth's server-side RFID authentication on the backend.

Client-side software is written in Go.

small_linus.jpg

In previous blog posts, I've showed how to use small LCD displays as a Linux framebuffer on the BeagleBone Black thanks to the fbtft drivers:

 

In this post, I will show how to use fbtft drivers on BBB with the latest version of the Linux kernel.  In this case, that is Linux 4.4.


Full transcript in this GitHub Gist.

 

 

Step 1: Build kernel


Clone Robert C. Nelson's bb-kernel repo and checkout the am33x-v4.4 branch.  When I did last week, the latest kernel version was 4.4-rc1-bone0:

laptop$ git clone https://github.com/RobertCNelson/bb-kernel

 

laptop$ cd bb-kernel/

 

laptop$ git checkout am33x-v4.4

 

laptop$ ./build_kernel.sh

 

The build kernel script will at some point open the kernel config menu system.  Enable Device Drivers->Staging->fbtft:

a.png

b.png

c.png

d.png



Step 2: Install kernel


Flash latest Debian 8.2 (Jessie) console image for the BBB:

laptop$ wget https://rcn-ee.com/rootfs/bb.org/testing/2015-11-15/console/bone-debian-8.2-console-armhf-2015-11-15-2gb.img.xz

 

laptop$ xz -d bone-debian-8.2-console-armhf-2015-11-15-2gb.img.xz

 

laptop$ sudo dd if=/home/afustini/Downloads/bbb-images/bone-debian-8.2-console-armhf-2015-11-15-2gb.img.xz of=/dev/sdc

 

laptop$ sudo eject /dev/sdc

 

Remove and re-insert so that fs gets mounted.  Run this from bb-kernel directory:

laptop$ ./tools/install_kernel.sh

 

Eject card and boot the BeagleBone with it.  Once booted, grow the filesystem to make use of free space on the card:

bone$ sudo /opt/scripts/tools/grow_partition.sh

 

bone$ sudo reboot

 

Finish installation of the new kernel on the BeagleBone.  The install script fails to do this.  In this case, my new kernel is 4.4.0-rc1-bone0:

bone$ sudo cp -pr /dtbs /boot/dtbs/4.4.0-rc1-bone0

 

bone$ sudo cp /zImage /boot/vmlinuz-4.4.0-rc1-bone0

 

Edit /boot/uEnv.txt on Beaglebone so that the new kernel is booted:

bone$ sudo vi /boot/uEnv.txt

uname_r=4.4.0-rc1-bone0

dtb=am335x-boneblack-overlay.dtb

 

bone$ sudo reboot

 

Verify the the BeagleBone booted the new kernel:

bone$ uname -a

Linux beaglebone 4.4.0-rc1-bone0 #4 Thu Nov 19 20:26:04 CST 2015 armv7l GNU/Linux

 

 

Step 3: Configure SPI

 

Build the latest Device Tree Overlays:

bone$ sudo apt-get update

 

bone$ sudo apt-get install git

 

bone$ git clone https://github.com/beagleboard/bb.org-overlays

 

bone$ cd bb.org-overlays

 

bone$ ./dtc-overlay.sh

 

bone$ ./install.sh


Load the Device Tree Overlay for BB-SPIDEV1 "virtual cape" as my LCD is wired up to spi1 pins:

bone$ cat /sys/devices/platform/bone_capemgr/slots

0: PF----  -1

1: PF----  -1

2: PF----  -1

3: PF----  -1


bone$ sudo /bin/sh -c 'echo BB-SPIDEV1 > /sys/devices/platform/bone_capemgr/slots'


bone$ cat /sys/devices/platform/bone_capemgr/slots

0: PF----  -1

1: PF----  -1

2: PF----  -1

3: PF----  -1

4: P-O-L-  0 Override Board Name,00A0,Override Manuf,BB-SPIDEV1

 

 

Step 4: Load fbtft drivers

 

Load fbtft_device module for adafruit18 (Adafruit 1.8" TFT LCD) which will use the fb_st7735r driver:

bone$ sudo modprobe fbtft_device busnum=1 name=adafruit18 debug=7 verbose=3 gpios=dc:48,reset:60


Display image on the LCD display:

bone$ sudo apt-get install fbi

bone$ wget 'http://beagleboard.org/static/uploads/BorisTux_w_Logo.png'

bone$ sudo fbi -d /dev/fb0 -T 1 -a BorisTux_w_Logo.png

IMG_20151119_021028.jpg

Texas Instruments has their own Linux kernel repo with branches to support their processors such as the Sitara AM3358 in the BeagleBone Black:

 

Gitorious@TI: ti-linux-kernel

This repo contains a Linux kernel that has been integrated with outstanding TI open source patches based on the open source Linux kernel found at kernel.org


Here is a good presentation for TI TechDay 2015 on how TI handles Linux engineering.

 

The most excellent Robert C. Nelson has made it very easy to run TI kernels on your BeagleBone Black by using his ti-linux-kernel-dev repo.  The newest branch is ti-linux-4.1.y.  While current kernel.org stable is 4.3, TI is working on 4.1 as it is current Long Term Support (LTS) kernelLinux 4.4 is expected to be released at the end of the year, and that will become the new LTS kernel.  I believe TI will then move forward to that.

 

A big advantage of moving to Linux 4.1 is that the fbtft drivers are now in the Linux kernel: drivers/staging/fbtftLast December, Thomas Petazzoni of Free Electrons took it upon himself to add notro's fbtft drivers to the kernel: [PATCH 00/29] staging: add drivers from the fbtft project.  Development in notro's repo has ceased and moved to the Linux kernel drivers staging treefbtft is maintained by Noralf Trønnes (notro) & Thomas Petazzoni.

 

Here are the steps that I followed.  Full transcript is in my GitHub Gist.

 

Step 1: Build kernel

These commands were on my 64-bit Intel laptop running Debian GNU/Linux 8.2:

laptop$ git clone https://github.com/RobertCNelson/ti-linux-kernel-dev/

Cloning into 'ti-linux-kernel-dev'...

remote: Counting objects: 6549, done.

remote: Compressing objects: 100% (56/56), done.

remote: Total 6549 (delta 37), reused 0 (delta 0), pack-reused 6493

Receiving objects: 100% (6549/6549), 5.21 MiB | 3.17 MiB/s, done.

Resolving deltas: 100% (5036/5036), done.

Checking connectivity... done.

 

 

laptop$ cd ti-linux-kernel-dev

 


laptop$ git checkout ti-linux-4.1.y

Branch ti-linux-4.1.y set up to track remote branch ti-linux-4.1.y from origin by rebasing.

Switched to a new branch 'ti-linux-4.1.y'

 


laptop$ ./build_kernel.sh


After running for awhile, build_kernel.sh will invoke the kernel config menu.  Enable the fbtft modules located in the Device Drivers -> Staging menu.  Here are photos of kernel config menus:

config1.png

config2.png

config3.png

config4.png


Step 2: Flash SD card

Flash a Debian 8.2 (Jessie) Snapshot console image from the BeagleBoneBlack Debian page on the eLinux.org wiki:

laptop$ sudo dd if=bone-debian-8.2-console-armhf-2015-10-11-2gb.img of=/dev/sdc

3481600+0 records in

3481600+0 records out

1782579200 bytes (1.8 GB) copied, 686.836 s, 2.6 MB/s

 

laptop$ sudo eject /dev/sdc

 

Step 3: Install new kernel

Re-insert SD card so that its filesystem is mounted.  Run the kernel install script from your ti-linux-kernel-dev directory:

laptop$ sudo ./tools/install_kernel.sh


Unmount and eject the SD card:

laptop$ sudo umount /dev/sdc1

laptop$ sudo eject /dev/sdc


Insert SD card into BeagleBone Black and boot it.

 

The install script fails to do the following so it must be done manually.  Copy the kernel image and device tree bindings to the expected location:

bone$ sudo cp /zImage /boot/vmlinuz-4.1.13-ti-r30

bone$ sudo cp -pr /dtbs /boot/dtbs/4.1.13-ti-r30

 

Edit /boot/uEnv.txt to set uname_r=4.1.13-ti-r30 and set dtb=am335x-boneblack-overlay.dtb:

bone$ sudo vi /boot/uEnv.txt

uname_r=4.1.13-ti-r30

dtb=am335x-boneblack-overlay.dtb


Run script to grow filesystem to make use of the SD cards full capacity:

bone$ cd /opt/scripts/tools

bone$ sudo ./grow_partition.sh


Reboot the BeagleBone:

bone$ sudo reboot

 

After rebooting, verify that the new kernel is running:

bone$ uname -a

Linux beaglebone 4.1.13-ti-r30 #1 SMP PREEMPT Mon Nov 16 00:50:22 CST 2015 armv7l GNU/Linux

 

Step 4: Enable SPI

Now build & install the latest Device Tree Overlays from bb.org-overlays repo:

bone$ git clone https://github.com/beagleboard/bb.org-overlays

bone$ cd bb.org-overlays/

bone$ ./dtc-overlay.sh

bone$ ./install.sh

 

Enable the spi1 peripheral (which LCD is wired up to) by loading the BB-SPIDEV1 Device Tree overlay:

bone$ cat /sys/devices/platform/bone_capemgr/slots

0: PF---- -1

1: PF---- -1

2: PF---- -1

3: PF---- -1

 

bone$ sudo /bin/sh -c 'echo BB-SPIDEV1 > /sys/devices/platform/bone_capemgr/slots'

 

bone$ cat /sys/devices/platform/bone_capemgr/slots

0: PF---- -1

1: PF---- -1

2: PF---- -1

3: PF---- -1

4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-SPIDEV1

 

Step 5: Load fbtft driver

Load the fbtft_device kernel module for adafruit18 (Adafruit 1.8" TFT LCD) which will then load the fb_st7735r driver:

bone$ sudo modprobe fbtft_device busnum=1 name=adafruit18 debug=7 verbose=3 gpios=dc:48,reset:60

 

Install fbi to display image on the LCD:

bone$ sudo apt-get update

bone$ sudo apt-get install fbi

 

bone$ wget 'http://beagleboard.org/static/uploads/BorisTux_w_Logo.png'

bone$ sudo fbi -d /dev/fb1 -T 1 -a BorisTux_w_Logo.png

bbb1.jpg

My previous post showed how to use small TFT LCDs as a Linux framebuffer on a BeagleBone Black:

 

BeagleBone Black LCDs with Prebuilt FBTFT drivers

 

I showed how to use pre-built fbtft kernel modules to provide the necessary Linux device driver.  However, what if you want to use fbtft modules with a newer version of the Linux kernel?

 

The BeagleBone Black currently ships with a Linux 3.8 kernel built from Robert C. Nelson's am33x-v3.8 branch.  I do also have fbtft working on the BBB with newer kernels such as TI's 4.1 branch and mainline 4.4-rc1, but I will focus on Linux 3.8 for this post.

 

Here is how I built FBTFT for Linux 3.8.13-bone79 kernel:

(for my complete transcript see this GitHub Gist)

 

Step 1: Clone repo & checkout branch

Clone bb-kernel repo & checkout am33x-v3.8 branch

$ git clone https://github.com/RobertCNelson/bb-kernel

 

$ cd bb-kernel

 

$ git checkout am33x-v3.8

Already on 'am33x-v3.8'

Your branch is up-to-date with 'origin/am33x-v3.8'.

 

Step 2: Run build script

Move into the new branch directory & run the build kernel script:

$ ./build_kernel.sh

<snip>

-----------------------------

make -j4 ARCH=arm LOCALVERSION=-bone79 CROSS_COMPILE="ccache /home/afustini/dev/bbb/bb-kernel/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-" dtbs

-----------------------------

<snip>

Script Complete

 

Step 3: Add fbtft drivers

Add fbtft drivers into Linux kernel source based on instructions from fbtft README.

 

From within the bb-kernel dir:

$ cd KERNEL/drivers/video

 

 

$ git clone https://github.com/notro/fbtft

Cloning into 'fbtft'...

remote: Counting objects: 1170, done.

remote: Total 1170 (delta 0), reused 0 (delta 0), pack-reused 1170

Receiving objects: 100% (1170/1170), 526.16 KiB | 0 bytes/s, done.

Resolving deltas: 100% (726/726), done.

Checking connectivity... done.

 

Add to KERNEL/drivers/video/Kconfig:

source "drivers/video/fbtft/Kconfig"

 

Add to KERNEL/drivers/video/Makefile:

obj-y += fbtft/


Verify files were modified correctly

$ git diff

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig

index a0c757a..50c5d62 100644

--- a/drivers/video/Kconfig

+++ b/drivers/video/Kconfig

@@ -2494,4 +2494,6 @@ config FB_SSD1307

  This driver implements support for the Solomon SSD1307

  OLED controller over I2C.

 

+source "drivers/video/fbtft/Kconfig"

+

endmenu

diff --git a/drivers/video/Makefile b/drivers/video/Makefile

index 28bfbca..6bd03af 100644

--- a/drivers/video/Makefile

+++ b/drivers/video/Makefile

@@ -174,3 +174,6 @@ obj-$(CONFIG_DISPLAY_TIMING) += display_timing.o

obj-$(CONFIG_OF_DISPLAY_TIMING) += of_display_timing.o

obj-$(CONFIG_VIDEOMODE) += videomode.o

obj-$(CONFIG_OF_VIDEOMODE) += of_videomode.o

+

+obj-y += fbtft/

+

 

Step 4: Rebuild kernel

Now run the rebuild script to compile the fbtft modules:

$ ./tools/rebuild.sh

+ Detected build host ["Fedora release 22 (Twenty Two)"]

+ host: [x86_64]

+ git HEAD commit: [a50680ea2cc2fc4519353dee4c1cbb47e475d8b2]

<snip>

 

The kernel config menu should appear shortly after starting the rebuild script.  Follow these screenshots to select the fbtft drivers:

step1.png

step2.png

step3.png

test4.png

After exit the kernel config menu, the rebuild script should continue:

‘.config’ -> ‘/home/afustini/dev/bbb/bb-kernel/patches/defconfig’

-----------------------------

make -j4 ARCH=arm LOCALVERSION=-bone79 CROSS_COMPILE="ccache /home/afustini/dev/bbb/bb-kernel/dl/gcc-linaro-arm-linux-gnueabihf-4.7-2013.04-20130415_linux/bin/arm-linux-gnueabihf-" zImage modules

-----------------------------

scripts/kconfig/conf --silentoldconfig Kconfig

<snip>

Script Complete

 

Verify in bb-kernel dir that fbtft modules were compiled:

$ find |grep fbtft |grep ko$

./KERNEL/drivers/video/fbtft/fb_upd161704.ko

./KERNEL/drivers/video/fbtft/fb_ili9486.ko

<snip>

./KERNEL/drivers/video/fbtft/fb_pcd8544.ko

./KERNEL/drivers/video/fbtft/fb_tls8204.ko

 

Verify in bb-kernel/deploy that kernel and tarballs were created

$ ls -ltar deploy/

-rwxrwxr-x 1 afustini afustini 5552136 Oct 31 13:01 3.8.13-bone79.zImage

-rw-rw-r-- 1 afustini afustini 110207 Oct 31 13:01 config-3.8.13-bone79

-rw-rw-r-- 1 afustini afustini 11690719 Oct 31 13:01 3.8.13-bone79-modules.tar.gz

-rw-rw-r-- 1 afustini afustini 1263879 Oct 31 13:01 3.8.13-bone79-firmware.tar.gz

-rw-rw-r-- 1 afustini afustini 39642 Oct 31 13:01 3.8.13-bone79-dtbs.tar.gz

 

Step 5: Install new kernel on SD Card (from Linux host)

My SD card already had been imaged with:

 

From within bb-kernel dir

$ sudo ./tools/install_kernel.sh

ERROR: MMC is not defined in system.sh

 

Edit script to specify which device is your SD card:

$ vi system.sh

 

Install new kernel onto microSD card:

$ sudo ./tools/install_kernel.sh

<snip>

Installing 3.8.13-bone79-modules.tar.gz to /dev/sdd2

info: [3.8.13-bone79] now installed...

This script has finished...

For verification, always test this media with your end device...

 

Step 6: Boot new kernel

Boot BBB with the updated microSD card:

$ dmesg| head

[ 0.000000] Booting Linux on physical CPU 0x0

[ 0.000000] Initializing cgroup subsys cpu

[ 0.000000] Linux version 3.8.13-bone79 (XXXX@YYYY) (gcc version 4.7.3 20130328 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.04-20130415 - Linaro GCC 2013.04) ) #4 SMP Sat Oct 31 13:00:55 CDT 2015

 

$ uname -a

Linux beaglebone 3.8.13-bone79 #4 SMP Sat Oct 31 13:00:55 CDT 2015 armv7l GNU/Linux

 

$ find /lib/modules/3.8.13-bone79/|grep fbtft

/lib/modules/3.8.13-bone79/kernel/drivers/video/fbtft

/lib/modules/3.8.13-bone79/kernel/drivers/video/fbtft/fb_pcd8544.ko

/lib/modules/3.8.13-bone79/kernel/drivers/video/fbtft/fb_ili9486.ko

<snip>

/lib/modules/3.8.13-bone79/kernel/drivers/video/fbtft/fbtft.ko

 

Edit u-boot config file uEnv.txt so the SPIDEV1 loads at boot and HDMI & eMMC are not loaded

cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G

cape_enable=capemgr.enable_partno=BB-SPIDEV1

 

For reference, this is my uEnv.txt

 

Verify that HDMI & eMMC are not loaded and SPIDEV1 is loaded:

NOTE: My BBB has no need for HDMI or eMMC. It may not be completely necessary to disable, but I did not investigated this.

$ cat /sys/devices/bone_capemgr.9/slots

0: 54:PF---

1: 55:PF---

2: 56:PF---

3: 57:PF---

4: ff:P-O-- Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G

5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI

6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-SPIDEV1

 

Step 7: Load fbtft driver & test display:

Photos of breadboard wiring using SPI1 (CS0, MOSI, SCLK), D/C, RESET.

 

Load fbtft st7735r driver for adafruit18 (Adafruit 1.8" TFT LCD display):

$ sudo modprobe fbtft_device busnum=1 name=adafruit18 debug=7 verbose=3 gpios=dc:48,reset:60

 

Console should now appear on the display. Refer to photos.

 

NOTE: if you have not already done, so run script to make sure all the free space on SD card can be utilized

$ sudo /opt/scripts/tools/grow_partition.sh

 

NOTE: apt-get may fail with warning "There is no public key available for the following key IDs". Fix by running running:

$ sudo apt-get install debian-keyring debian-archive-keyring

$ sudoe apt-get update

 

Display image file on the display with fbi:

$ sudo apt-get install fbi

$ wget https://kernel.org/theme/images/logos/tux.png

$ sudo fbi -d /dev/fb0 -T 1 -a tux.png

using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf

 

Play video clip on the display with mplayer:

$ sudo apt-get install mplayer

$ wget http://hubblesource.stsci.edu/sources/video/clips/details/images/hst_1.mpg

$ sudo mplayer -nolirc -vo fbdev:/dev/fb0 scale=WIDTH:128 hst_1.mpg

 

Kernel log with verbose debug output for adafruit18:


If using the Adafruit 2.2" TFT LCD display, then specify adafruit22a [note: the "a" suffix is important]

$ sudo modprobe fbtft_device busnum=1 name=adafruit22a debug=7 verbose=3 gpios=dc:48,reset:60

 

fbi and mplayer all work OK for adafruit22a.  Kernel log with verbose debug output for adafruit22a:

 

Links

BeagleBone Black using Prebuilt FBTFT drivers


 

 

Step 1: Download, Flash & Boot Image

 

Download bone-debian-7.5-2014-05-14-2gb image:


http://debian.beagleboard.org/images/bone-debian-7.5-2014-05-14-2gb.img.xz


Write image to SD card.  Here is example on my Linux laptop:

$ sudo dd if=/home/afustini/Downloads/bone-debian-7.5-2014-05-14-2gb.img of=/dev/sdc

 

Boot the BeagleBone with the microSD card and verify it is running Linux kernel 3.8.13-bone50:

$ cat /proc/version

Linux version 3.8.13-bone50 (root@imx6q-wandboard-2gb-0) (gcc version 4.6.3 (Debian 4.6.3-14) ) #1 SMP Tue May 13 13:24:52 UTC 2014

 

$ cat /etc/dogtag

BeagleBoard.org BeagleBone Debian Image 2014-05-14

 

 

Step 2: Expand SD card to ensure full capacity

 

Run script to grow the filesystem as root on BeagleBone:

$ sudo /opt/scripts/tools/grow_partition.sh

 

sfdisk: backing up partition layout.

sfdisk: initial calculation.

 

Disk /dev/mmcblk0: 242560 cylinders, 4 heads, 16 sectors/track

Old situation:

Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

<snip>

 

Re-reading the partition table ...

BLKRRPART: Device or resource busy

The command to re-read the partition table failed.

Run partprobe(8), kpartx(8) or reboot your system now,

before using mkfs

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)

to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1

(See fdisk(8).)

 

Reboot the BeagleBone and verify that the root filesystem now is using the entire capacity of the the microSD card:

$ df -h

Filesystem Size Used Avail Use% Mounted on

rootfs 7.2G 1.6G 5.4G 22% /

<snip>

 

 

Step 3: Install prebuilt fbtft drivers


Download the prebuilt fbtft kernel modules:

$ wget tronnes.org/downloads/fbtft-2014-02-07-3.8.13-bone50.tar.gz

 

Install the kernel modules:

$ sudo tar -zxPvf fbtft-2014-02-07-3.8.13-bone50.tar.gz

/lib/modules/3.8.13-bone50/extra/

/lib/modules/3.8.13-bone50/extra/fb_pcd8544.ko
/lib/modules/3.8.13-bone50/extra/fb_ili9340.ko

<snip>
/lib/modules/3.8.13-bone50/extra/fbtft.ko

 

$ sudo depmod


Verify the modules are for 3.8.13-bone50:

$ modinfo fbtft

 

filename: /lib/modules/3.8.13-bone50/extra/fbtft.ko

license: GPL

srcversion: 3C6839F44999EEA4C1D8A9F

depends:

vermagic: 3.8.13-bone50 SMP mod_unload modversions ARMv7 thumb2 p2v8

parm: debug:override device debug level (ulong)

parm: dma:Use DMA buffer (bool)


Edit /boot/uboot/uEnv.txt to disable HDMI & eMMC "virtual capes" and enable SPIDEV1 "virtual cape":

$ sudo vi /boot/uboot/uEnv.txt

 

Uncomment this cape_disable line for HDMI & eMMC:

##BeagleBone Black:

##Disable HDMI/eMMC

cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G


Add this line to enable SPIDEV1:

cape_enable=capemgr.enable_partno=BB-SPIDEV1

 

Save the changes uEnv.txt & reboot the BeagleBone

 

 

Step 4: Load fbtft driver

 

Verify which capes are loaded:

$ cat /sys/devices/bone_capemgr.9/slots

 

0: 54:PF---

1: 55:PF---

2: 56:PF---

3: 57:PF---

4: ff:P-O-- Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G

5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI

6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN

7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-SPIDEV1


Use fbtft_device kernel module to load the fb_st7735r driver for Adafruit 1.8" TFT LCD display connected to SPI1:

$ sudo modprobe fbtft_device busnum=1 name=adafruit18 debug=7 verbose=3 gpios=dc:48,reset:60


OR


Use fbtft_device kernel module to load the fb_ili9340 driver for Adafruit 2.2" TFT LCD display connected to SPI1:

$ sudo modprobe fbtft_device busnum=1 name=adafruit22a debug=7 verbose=3 gpios=dc:48,reset:60

NOTE: a suffix is important in adafruit22a

 

/dev/fb0 device should now exist:

$ ls -lsda /dev/fb*

0 crw-rw---T 1 root video 29, 0 Oct 30 06:27 /dev/fb0

 

The system console should now be displayed on the LCD:

IMG_20151030_005012.jpg

More photos of fbtft working for 1.8" & 2.2" TFT LCDs

 

Example kernel log:

[ 181.848604] fbtft_device: SPI devices registered:

[ 181.848671] fbtft_device: spidev spi1.1 16000kHz 8 bits mode=0x00

[ 181.848705] fbtft_device: spidev spi1.0 16000kHz 8 bits mode=0x01

[ 181.848728] fbtft_device: 'fb' Platform devices registered:

[ 181.848860] fbtft_device: omapfb id=-1 pdata? yes

[ 181.849152] fbtft_device: Deleting spi1.0

[ 181.851923] fbtft_device: GPIOS used by 'adafruit22a':

[ 181.851960] fbtft_device: 'dc' = GPIO48

[ 181.851982] fbtft_device: 'reset' = GPIO60

[ 181.852002] fbtft_device: SPI devices registered:

[ 181.852033] fbtft_device: spidev spi1.1 16000kHz 8 bits mode=0x00

[ 181.852061] fbtft_device: fb_ili9340 spi1.0 32000kHz 8 bits mode=0x00

[ 182.235255] Console: switching to colour frame buffer device 60x53

[ 182.236682] graphics fb0: fb_ili9340 frame buffer, 240x320, 150 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi1.0 at 32 MHz

 

 

Step 5: Display images and video

 

Based on FBTFT Wiki article: Framebuffer use

 

When using a fresh Debian image, one should first update the list of available packages before attempting to install new packages:

$ sudo apt-get update

Reading package lists... Done

W: There is no public key available for the following key IDs:

9D6D8F6BC857C906


Fix public key ID warning:

$ sudo apt-get install debian-keyring debian-archive-keyring

 

$ sudo apt-get update


Install fbi utility to display image files on the framebuffer device:

$ sudo apt-get install fbi

 

$ wget https://kernel.org/theme/images/logos/tux.png

 

$ sudo fbi -d /dev/fb0 -T 1 -a tux.png

using "DejaVu Sans Mono-16", pixelsize=16.67 file=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansMono.ttf


Tux the Linux mascot should now be displayed on the LCD:

IMG_20151030_024223.jpg

More photos of fbtft working for 1.8" & 2.2" TFT LCDs


Next, install mplayer to play a MPEG-2 video clip:

$ sudo apt-get install mplayer

 

$ wget http://hubblesource.stsci.edu/sources/video/clips/details/images/hst_1.mpg

 

$ sudo mplayer -nolirc -vo fbdev:/dev/fb0 scale=WIDTH:128 hst_1.mpg

MPlayer svn r34540 (Debian), built with gcc-4.6 (C) 2000-2012 MPlayer Team

 

Playing scale=WIDTH:128.

File not found: 'scale=WIDTH:128'

Failed to open scale=WIDTH:128.

 

 

Playing hst_1.mpg.

libavformat version 53.21.1 (external)

Mismatching header version 53.19.0

MPEG-ES file format detected.

VIDEO: MPEG1 320x240 (aspect 1) 29.970 fps 320.0 kbps (40.0 kbyte/s)

Load subtitles in ./

==========================================================================

Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family

libavcodec version 53.35.0 (external)

Mismatching header version 53.32.2

Selected video codec: [ffmpeg1] vfm: ffmpeg (FFmpeg MPEG-1)

==========================================================================

Audio: no sound

Starting playback...

Unsupported PixelFormat 61

Unsupported PixelFormat 53

Unsupported PixelFormat 81

Could not find matching colorspace - retrying with -vf scale...

Opening video filter: [scale]

Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.

[swscaler @ 0xb670f978]No accelerated colorspace conversion found from yuv420p to rgb565le.

[swscaler @ 0xb670f978]using unscaled yuv420p -> rgb565le special converter

VO: [fbdev] 320x240 => 320x240 BGR 16-bit

framebuffer too small for double-buffering, disabling

V: 19.0 570/570 20% 65% 0.0% 0 0

 

 

Exiting... (End of file)

 

You should now see the video clip playing on the display:

IMG_20151030_031620.jpg

Borissmall-tor-bbb.jpgTor logo

My Tor relay running on a BeagleBone Black is even faster after upgrading to Debian 8 (Jessie) and TorProject.org tor 0.2.6 package for Jessie:

15 - 1.jpg


Thanks to Alison Macrina of the Library Freedom Project for the motivation to upgrade after watching her inspiring talk during the Aaron Swartz's Day 2015 celebration at Internet Archive last weekend:

 

A quick aside, if you've not seen this documentary about Aaron's life, then please be sure to watch it:


And... thanks to Comcast.  Despite their past sins, I've been able to run a Tor exit node (e.g. exit relay) via my cable modem connection for 1.5 years with no problems.  My connect is 50 Mbps down and 10 Mbps up.

 

My current Tor config

https://gist.github.com/pdp7/597d66f5178781eb5007


 

Previous version

My BBB had previously been running Debian 7 (Wheezy) for which TorProject.org package was 0.2.4.


Reduced Exit Policy

If you run a Tor exit node, then I recommend using this Reduced Exit Policy which will limit BitTorrent traffic (and thus DMCA complaints):

https://trac.torproject.org/projects/tor/wiki/doc/ReducedExitPolicy

 

Debian 8 image

My BeagleBone Black is running this Debian 8.2 (Jessie) image from Robert C Nelson listed on eLinux.org:

Jessie Snapshot console

Flasher: (console) (BeagleBone Black/Green eMMC):

wget https://rcn-ee.com/rootfs/bb.org/testing/2015-11-08/console/BBB-eMMC-flasher-debian-8.2-console-armhf-2015-11-08-2gb.img.xz

sha256sum: 3c489ef2d6809a7b50396d16770752a8c067478680946428d12a747bb8c4688f


Background:

I've not posted about my Tor relay on element14 Community before, so I figure I should provide some context.

 

Last year I did a presentation at my hackerspace about how to run a Tor relay on a BeagleBone Black:

 

 

If that Meetup link breaks over time, then here is a GitHub Gist all my notes and links:

 

 

I was inspired to run a Tor relay after watching these talks:

 

 

 

Tor for users

 

Talks by Josh Datko about Tor & BeagleBone

How Tor works

Tor Hardware Hacking

 

Tor on BeagleBone blog posts:

 

Run a your own Tor relay!

 

Stats for my BeagleBone Black relay


Notes for Tor Relay running as Exit Node

 

Not into running a Tor relay home?

# file: /etc/tor/torrc

ORPort 443

Exitpolicy reject *:*

Nickname EFFisMyHero

ContactInfo pdp7pdp7 AT gmail dot com GPG: 0x84D44A9317F1138E

Log notice file /var/log/tor/notices.log

RelayBandwidthRate 1024 KB

RelayBandwidthBurst 1024 KB

MaxAdvertisedBandwidth 1024 KB

DisableDebuggerAttachment 0


Stats for my EFFisMyHero relay on DigitalOcean:

 

Not into running your own Tor relay?

NASA Jet Propulsion Laboratory prototyped a new rover design with the BeagleBone Black!

 

"Testing a Space Rover Under Alaskan Ice"

 

 

Here's a screenshot of the BeagleBone:

Screenshot from 2015-06-15 16:40:18.png

I've previously had great results connecting Adafruit 8x8 LED matrix displays to the BeagleBone Black via I2C:

 

I decided to try out the Adafruit bi-color 8x8 LED matrix and hooked it up with the same I2C pins as before.  You'll need to setup the Adafruit_BBIO Python library if you haven't already:

https://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/overview

 

You'll also want to grab the Adafruit Python libraries for the Raspberry Pi since they work on BeagleBone Black, too:

https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code

 

Here is the BegaleBone Black running the demo program ex_8x8_color_pixels.py from the repo:

https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code

 

BeagleBone Black & Adafruit 8x8 bi-color matrix

https://www.youtube.com/watch?v=vnHC6bVj5bc

 

I thought it would be interesting to plot the readings from a sensor over time on the matrix with different colors representing the magnitude of the reading:

20140116_104027.jpg

 

I hooked up a pot to the analog input to simulate a sensor.  Here's the Python script:

https://github.com/pdp7/beaglebackpack/blob/master/plot.py

 

It is Invoked by this shell script so that PYTHONPATH will be set:

https://github.com/pdp7/beaglebackpack/blob/master/plot.sh

 

BeagleBone Black: plot analog sensor on Adafruit bi-color LED matrix

https://www.youtube.com/watch?v=QQNqxHQDj5E

 

Cheers,

Drew

http://twitter.com/pdp7

The wonderful Trammel Hudson of NYC Resistor posted the BeagleBone cape PCB to connect the BeagleBone BlackBeagleBone Black to the Adafruit 16x32 RGB LED matrixAdafruit 16x32 RGB LED matrix to create the dazzling Octoscroller:

i.png

OSH Park ~ Octoscroller v2

 

Just ordered updated Octoscroller boards. OSH Park has an awesome zero-friction Eagle CAD to PCB production process.

Drives up to eight chains of 32x16 or 32x32 LED panels with a Beagle Bone Black.

 

Wondering what the Octoscroller is?  Check out Trammel's excellent blog post:

 

Octoscroller » NYC Resistor

Hexascroller has been a central fixture at NYCR for the past few years, with a few ups and downs. It’s replacement, Octoscroller, improves on our classic message alert polygon by having two more sides and two more colors of LEDs.

The brains are a BeagleBone Black running the LEDscape custom PRU firmware. The AM355 CPU in the BBB has two separate realtime microcontrollers built into its die, both with full access to the GPIO lines and cache coherent access to main memory. This bit of hardware/software allows the user application to simply render into a frame buffer, which is then driven to the panels by the PRU.

9702197818_9e7ac1aa82_z.jpg

 

cheers,

drew

http://twitter.com/pdp7

20131218_024345-MOTION (1).gif20131223_112415-MOTION (1).gif

20131218_024320.jpg

I previously wrote about using the 8x8 LED matrix with the BeagleBone Black and visualizing Facebook notifications on the matrix.  Adafruit has an interesting tutorial about using multiple 8x8 LED matrix displays together:

 

Animating Multiple LED Backpacks

http://learn.adafruit.com/animating-multiple-led-backpacks

skull2.jpg

The above tutorial was written for the ArduinoArduino, but I wanted to control multiple Adafruit 8x8 LED matrix displaysAdafruit 8x8 LED matrix displays with the BeagleBone BlackBeagleBone Black.  I lucked out when I found Matt Hassel's LED Stock Ticker project for the Raspberry PiRaspberry Pi.  He built upon the Adafruit Python library for the 8x8 matrix and wrote new code to handle scrolling text across multiple displays.  I was able to get Matt Hassel's Python code to run on the BeagleBone Black, and I reworked bi-color matrix code to work with the single color 8x8 matrix displays like my red model.  Here is my GitHub repo for all of my Adafruit LED backpack (8x8 matrix & 7-segment) projects for the BBB:

 

GitHub: pdp7 / beaglebackpack

https://github.com/pdp7/beaglebackpack


A Python program, ticker.py, will scroll a message across the matrix displays.  Before running it, follow Adafruit's instructions to install their Adafruit-BeagleBone-IO-Python library:


Installation on Angstrom | Setting up IO Python Library on BeagleBone Black | Adafruit Learning System

http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/installation

 

Next follow these instructions on the BeagleBone:

cd $HOME

git clone git://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code.git

git clone git://github.com/pdp7/beaglebackpack.git

cd beaglebackpack

bash ./ticker.sh -r "Happy Holidays 2013"

 

The message should then scroll across the two displays:

 

Happy Holidays: BeagleBone Black LED ticker

https://www.youtube.com/watch?v=wy1r8esEK6E

 

 

Cheers,

Drew

http://twitter.com/pdp7

UPDATE: Kim the Maker Mom did an awesome job on WGN News this morning.  Kids will be lucky to get these awesome STEM/DIY/maker gifts like littleBits, Bigshot Camera, GoldieBlox, Roominate, etc.  At 4m 25s, check out the BeagleBone Black and Adafruit 16x32 RGB LED panel (displaying output from LEDscape designed at NYC Resistor)


VIDEO: http://morningnews.wgntv.com/2013/12/05/tech-toy-gift-ideas/

BLOG: The Maker Mom: Hot Holiday STEM and Tech Gifts for Kids (Boys and Girls) 2013 as seen on WGN Morning News

Maker Mom on TV.JPG

Kim Moldofsky aka Maker Mom (http://www.themakermom.com/p/about.html) will be on Chicago's WGN TV morning news tomorrow around 8:45am US CST (http://wgntv.com/live/) to present STEM gift ideas including a BeagleBone BlackBeagleBone Black bundle provided by Newark element14 (http://www.newark.com/holidaydeals).  She will demo LEDscape (created at NYC Resistor) running on an Adafruit 16x32 RGB LED panelAdafruit 16x32 RGB LED panel:

 

BeagleBone Black sees color with OpenCV - YouTube

 

cheers,
drew

http://twitter.com/pdp7

20131126_100016 (1).jpg

Previously, I wrote a blog post about how I displayed the count of my unseen Facebook notifications on a 7-segment display7-segment display connected to the BeagleBone Black BeagleBone Black: BeagleBone Black displays Facebook notifications on Adafruit 7-segment.  I decided to do a similar task with the BeagleBone BlackBeagleBone Black & Adafruit 8x8 LED matrixAdafruit 8x8 LED matrix.  My most recent post that shows how it is interfaced with the BBB: Adafruit 8x8 LED matrix controlled by BeagleBone Black.

20131126_100049 (1).jpg

Here's the Python script that grabs the unseen notification count from the Facebook API and then displays it on the 8x8 matrix8x8 matrix.  One notification is one pixel.

https://gist.github.com/pdp7/7679350


Cheers,

Drew Fustini

http://twitter.com/pdp7

20131120_055834-ACTION.jpg

Similar to my previous post on Interfacing BeagleBone Black with Adafruit 7-segment LED display, I have hooked up the Adafruit 8x8 LED matrix with I2C "backpack"Adafruit 8x8 LED matrix with I2C "backpack".  This means the matrix is connected with just 4 wires (3.3VDC, GND, SDA, SCL) to the BeagleBone Black (e.g. BBB)BeagleBone Black (e.g. BBB) which is mounted on the Adafruit BeagleBone Black Proto PlateAdafruit BeagleBone Black Proto Plate:

20131120_055226.jpg

And like with the 7-segment LED "backpack", the Python module that Adafruit wrote for the Raspberry Pi works with the BeagleBone Black as well (hooray for the common abstraction of Linux and Python ):

https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/blob/master/Adafruit_LEDBackpack/Adafruit_8x8.py

 

I shot a video of it running the Adafruit_8x8.py example program:

 

Adafruit 8x8 LED matrix controlled by BeagleBone - YouTube

 

I'm looking forward to putting this display to use in a project.

 

Cheers,

Drew

http://twitter.com/pdp7

[A followup to Interfacing BeagleBone Black with Adafruit 7-segment LED display]

 

I've been working on a Python script to display my current number of unseen Facebook notifications (that white number in the redbox in the upper right of Facebook) using a Adafruit 7-segment display connected to a BeagleBone Black (aka BBB).BeagleBone Black (aka BBB).

20131107_121131.jpg

20131107_121446.jpg

Here is the code on GitHub Gist (a work in progress):

 

Cheers,

Drew

http://twitter.com/pdp7