dcsimg
Skip to end of metadata
Go to start of metadata

Introduction

This page will show you step-by-step how to interface a FLIR Lepton module to the BeagleBone Black/Green.

Hardware Requirements

 

BeagleBone Black at Digi-Key
BeagleBone Green at Digi-Key

LCD4/LCD7 for BeagleBone Black/Green:
LCD4 at Digi-Key
LCD7 at Digi-Key

FLIR Lepton:
Lepton Breakout Board at Digi-Key
FLIR CAMERA IR 80X60 50 DEGREE 9HZ at Digi-Key
FLIR CAMERA IR 80X60 50 DEG W/SHUTTER at Digi-Key
FLIR CAMERA IR 80X60 25 DEGREE 9HZ at Digi-Key

 

Software Requirements

 

Install latest console image to eMMC

Today the latest version is: 2016-09-28 (these are just weekly snapshots, so always check for the latest)

Flasher: (console) (BeagleBone Black/Green eMMC)
wget https://rcn-ee.com/rootfs/bb.org/testing/2016-09-28/console/BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.img.xz

sha256sum: deb1d25b6e8402683736edbf788a1b3c3933e326656132e7eef84eb46907a530

Insert microSD into pc adapter and check device node name (in our case /dev/sdd):

voodoo@hades:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sde      8:64   1   3.7G  0 disk 
└─sde1   8:65   1   3.3G  0 part 
sda      8:0    0 465.8G  0 disk 
└─sda1   8:1    0 465.8G  0 part /

Download the *.img.xz and matching *.bmap file, and write to microSD card via bmaptools:

voodoo@hades:~$ wget https://rcn-ee.com/rootfs/bb.org/testing/2016-09-28/console/BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.img.xz
voodoo@hades:~$ wget https://rcn-ee.com/rootfs/bb.org/testing/2016-09-28/console/BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.bmap
 
voodoo@hades:~$ sudo bmaptool copy BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.img.xz  /dev/sde
[sudo] password for voodoo: 
bmaptool: info: discovered bmap file 'BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.bmap'
bmaptool: info: block map format version 2.0
bmaptool: info: 435200 blocks of size 4096 (1.7 GiB), mapped 81391 blocks (317.9 MiB or 18.7%)
bmaptool: info: copying image 'BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.img.xz' to block device '/dev/sde' using bmap file 'BBB-blank-debian-8.6-console-armhf-2016-09-28-2gb.bmap'
bmaptool: info: 100% copied
bmaptool: info: synchronizing '/dev/sde'
bmaptool: info: copying time: 1m 2.7s, copying speed 5.1 MiB/sec

Insert microSD into BeagleBone Black/Green and wait for flashing procedure to finish. (device should shutdown)

Enable g_serial on usb mini connector

Since we will be using an LCD, we will be losing access to the J1 serial debug header on the baseboard.  So let's enable "g_serial" over the usb mini by default.  We can have current am335x_evm boot script to this for us, by removing "udhcpd"

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/am335x_evm.sh#L306

	if [ "x${root_drive}" = "x/dev/mmcblk0p1" ] || [ "x${root_drive}" = "x/dev/mmcblk1p1" ] ; then
		#g_ether: Do we have udhcpd/dnsmasq?
		if [ -f /usr/sbin/udhcpd ] || [ -f /usr/sbin/dnsmasq ] ; then
			modprobe g_ether ${g_network} || true
			usb0="enable"
		else
			#g_serial: As a last resort...
			modprobe g_serial || true
			ttyGS0="enable"
		fi
	else
		boot_drive="${root_drive%?}1"
		modprobe g_multi file=${boot_drive} cdrom=0 ro=0 stall=0 removable=1 nofua=1 ${g_network} || true
		usb0="enable"
		ttyGS0="enable"
	fi

Let's remove udhcpd

debian@beaglebone:~$ sudo apt-get remove udhcpd --purge
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  udhcpd*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 88.1 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 25430 files and directories currently installed.)
Removing udhcpd (1:1.22.0-9+deb8u1) ...
Purging configuration files for udhcpd (1:1.22.0-9+deb8u1) ...

On the next reboot:

[12339.755056] usb 4-2.1.1: USB disconnect, device number 4
[13459.943265] usb 3-2.1.2: new high-speed USB device number 7 using xhci_hcd
[13460.057810] usb 3-2.1.2: New USB device found, idVendor=0525, idProduct=a4a7
[13460.057814] usb 3-2.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[13460.057816] usb 3-2.1.2: Product: Gadget Serial v2.4
[13460.057818] usb 3-2.1.2: Manufacturer: Linux 4.4.22-ti-r50 with musb-hdrc
[13460.059964] cdc_acm 3-2.1.2:2.0: ttyACM0: USB ACM device

Using gtkterm we can get access via:

gtkterm -p /dev/ttyACM0 -s 115200 &

Setup basic window manager

For this project we are going to use openbox & slim to provide a very basic desktop environment on the LCD.

sudo apt-get update ; sudo apt-get install openbox slim xinit xserver-xorg-video-fbdev x11-xserver-utils git-core libpam-gnome-keyring feh

Setup /etc/X11/xorg.conf

/etc/X11/xorg.conf
Section "Monitor"
        Identifier      "Builtin Default Monitor"
EndSection
Section "Device"
        Identifier      "Builtin Default fbdev Device 0"
        Driver          "fbdev"
EndSection
Section "Screen"
        Identifier      "Builtin Default fbdev Screen 0"
        Device          "Builtin Default fbdev Device 0"
        Monitor         "Builtin Default Monitor"
        DefaultDepth    16
EndSection
Section "ServerLayout"
        Identifier      "Builtin Default Layout"
        Screen          "Builtin Default fbdev Screen 0"
EndSection

Update /boot/uEnv.txt to use the correct dtb for lcd usage

sudo sed -i 's/#dtb=$/dtb=am335x-boneblack-emmc-overlay.dtb/' /boot/uEnv.txt

Install device tree overlays for LCD4/LCD7

git clone https://github.com/beagleboard/bb.org-overlays --depth=1
cd ./bb.org-overlays
./dtc-overlay.sh
./install.sh

Shutdown system via:

sudo systemctl poweroff

Install LCD4/LCD7 and powerup BeagleBone Black/Green

Configure SLIM for autologin

Set Default User:

/etc/slim.conf
# default user, leave blank or remove this line
# for avoid pre-loading the username.
#default_user        simone
default_user debian

Enable auto-login

/etc/slim.conf
# Automatically login the default user (without entering
# the password. Set to "yes" to enable this feature
#auto_login          no
auto_login yes

Enable openbox:

echo "exec openbox-session" > /home/debian/.xsession

Lepton qt5 application

Build/Install Lepton application

sudo apt-get install build-essential qt4-dev-tools
 
git clone https://github.com/groupgets/LeptonModule --depth=1

Apply this patch, to push the application to the upper left:

diff --git a/software/beagleboneblack_video/main.cpp b/software/beagleboneblack_video/main.cpp
index 264b0a2..f31c467 100644
--- a/software/beagleboneblack_video/main.cpp
+++ b/software/beagleboneblack_video/main.cpp
@@ -18,7 +18,7 @@ int main( int argc, char **argv )
 	QApplication a( argc, argv );
 	
 	QWidget *myWidget = new QWidget;
-	myWidget->setGeometry(400, 300, 340, 290);
+	myWidget->setGeometry(20, 20, 340, 290);
 
 	//create an image placeholder for myLabel
 	//fill the top left corner with red, just bcuz

and finally build the project

cd /home/debian/LeptonModule/software/beagleboneblack_video/leptonSDKEmb32PUB/
make
cd ..
qmake && make

AutoStart this application on bootup:

mkdir -p /home/debian/.config/openbox/
echo "feh --bg-scale /opt/scripts/images/beaglebg.jpg" > /home/debian/.config/openbox/autostart
echo "/home/debian/LeptonModule/software/beagleboneblack_video/bbb &" >> /home/debian/.config/openbox/autostart

Increase LCD brightness

echo "echo 100 >> /sys/devices/platform/backlight/backlight/backlight/brightness" >> /opt/scripts/boot/am335x_evm.sh

LCD4 Setup

Enable the "BB_SPIDEV0" overlay:

sudo sh -c "echo 'cape_enable=bone_capemgr.enable_partno=BB-SPIDEV0' >> /boot/uEnv.txt"

LCD7 Setup

We need P9.30 for SPIDEV1, which is the enter key on the LCD7, so disable P9.30 in BB-BONE-LCD7-01-00A3.dts

diff --git a/src/arm/BB-BONE-LCD7-01-00A3.dts b/src/arm/BB-BONE-LCD7-01-00A3.dts
index a1c7833..4fdfc2d 100644
--- a/src/arm/BB-BONE-LCD7-01-00A3.dts
+++ b/src/arm/BB-BONE-LCD7-01-00A3.dts
@@ -48,7 +48,6 @@
 		"P9.15",	/* keys: gpio1_16 LEFT */
 		"P9.23",	/* keys: gpio1_17 RIGHT */
 		"P9.16",	/* keys: gpio1_19 UP */
-		"P9.30",	/* keys: gpio3_16 DOWN */
 		"P9.21",	/* keys: gpio0_3 ENTER */
 
 		"ehrpwm1a",
@@ -57,7 +56,6 @@
 		"gpio1_16",	/* LEFT */
 		"gpio1_17",	/* RIGHT */
 		"gpio1_19",	/* UP */
-		"gpio3_16",	/* DOWN */
 		"gpio0_3",	/* ENTER */
 		"lcdc",
 		"tscadc";
@@ -111,7 +109,6 @@
 					BONE_P9_15 (PIN_INPUT | MUX_MODE7) /* gpmc_a0.gpio1_16 */
 					BONE_P9_23 (PIN_INPUT | MUX_MODE7) /* gpmc_a1.gpio1_17 */
 					BONE_P9_16 (PIN_INPUT | MUX_MODE7) /* gpmc_a3.gpio1_19 */
-					BONE_P9_30 (PIN_INPUT | MUX_MODE7) /* mcasp0_axr0.gpio3_16 */
 					BONE_P9_21 (PIN_INPUT | MUX_MODE7) /* spi0_d0.gpio0_3 */
 				>;
 			};
@@ -222,14 +219,6 @@
 				};
 				button@4 {
 					debounce_interval = <50>;
-					linux,code = <108>;
-					label = "down";
-					gpios = <&gpio3 16 0x1>;
-					gpio-key,wakeup;
-					autorepeat;
-				};
-				button@5 {
-					debounce_interval = <50>;
 					linux,code = <28>;
 					label = "enter";
 					gpios = <&gpio0 3 0x1>;

Then rebuild:

cd ./bb.org-overlays
make clean
./install.sh

Enable the "BB_SPIDEV1" overlay:

sudo sh -c "echo 'cape_enable=bone_capemgr.enable_partno=BB-SPIDEV1' >> /boot/uEnv.txt"