Skip to content

Instantly share code, notes, and snippets.

@pdp7
Last active March 1, 2016 17:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdp7/44361549c75cfc143a98 to your computer and use it in GitHub Desktop.
Save pdp7/44361549c75cfc143a98 to your computer and use it in GitHub Desktop.
BeagleBone Black: prebuilt fbtft framebuffer drivers with Linux 3.8.13 kernel with 1.8" & 2.2" TFT LCD displays
#########################################
### BeagleBone Black
### prebuilt fbtft framebuffer drivers with Linux 3.8.13 kernel
### working with 1.8" & 2.2" TFT LCD displays
###
### Photos: https://plus.google.com/photos/+DrewFustini/albums/6211546193314906001
#########################################
Based on:
https://github.com/notro/fbtft/wiki/BeagleBone-Black
Prebuilt drivers for the bone-debian-7.5-2014-05-14-2gb
################################
## Flash and boot image
################################
## on my laptop:
dd if=/home/afustini/Downloads/bone-debian-7.5-2014-05-14-2gb.img of=/dev/sdc
root@beaglebone:~# 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
root@beaglebone:~# cat /etc/dogtag
BeagleBoard.org BeagleBone Debian Image 2014-05-14
######################################################
## Expand SD card to ensure full capacity can be used
######################################################
root@beaglebone:~# /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
Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 * 1 96 96 98304 e W95 FAT16 (LBA)
start: (c,h,s) expected (32,0,1) found (0,32,33)
end: (c,h,s) expected (1023,3,16) found (12,93,17)
/dev/mmcblk0p2 97 1699 1603 1641472 83 Linux
start: (c,h,s) expected (1023,3,16) found (12,93,18)
end: (c,h,s) expected (1023,3,16) found (216,183,31)
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0
Device Boot Start End MiB #blocks Id System
/dev/mmcblk0p1 * 1 96 96 98304 e W95 FAT16 (LBA)
/dev/mmcblk0p2 97 7579 7483 7662592 83 Linux
/dev/mmcblk0p3 0 - 0 0 0 Empty
/dev/mmcblk0p4 0 - 0 0 0 Empty
Successfully wrote the new partition table
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 BEAGLEBONE
root@beaglebone:~# df -h
Filesystem Size Used Avail Use% Mounted on
rootfs 7.2G 1.6G 5.4G 22% /
udev 10M 0 10M 0% /dev
tmpfs 100M 496K 99M 1% /run
/dev/mmcblk0p2 7.2G 1.6G 5.4G 22% /
tmpfs 249M 0 249M 0% /dev/shm
tmpfs 249M 0 249M 0% /sys/fs/cgroup
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 100M 0 100M 0% /run/user
/dev/mmcblk0p1 96M 70M 27M 73% /boot/uboot
######################################
## install prebuilt fbtft drivers
######################################
root@beaglebone:~# wget tronnes.org/downloads/fbtft-2014-02-07-3.8.13-bone50.tar.gz
root@beaglebone:~# 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
/lib/modules/3.8.13-bone50/extra/fb_hx8340bn.ko
/lib/modules/3.8.13-bone50/extra/fb_ili9325.ko
/lib/modules/3.8.13-bone50/extra/fb_ili9341.ko
/lib/modules/3.8.13-bone50/extra/fb_ssd1351.ko
/lib/modules/3.8.13-bone50/extra/fb_s6d1121.ko
/lib/modules/3.8.13-bone50/extra/fb_upd161704.ko
/lib/modules/3.8.13-bone50/extra/ads7846_device.ko
/lib/modules/3.8.13-bone50/extra/fb_watterott.ko
/lib/modules/3.8.13-bone50/extra/fb_bd663474.ko
/lib/modules/3.8.13-bone50/extra/fb_hx8347d.ko
/lib/modules/3.8.13-bone50/extra/fbtft_device.ko
/lib/modules/3.8.13-bone50/extra/fb_tinylcd.ko
/lib/modules/3.8.13-bone50/extra/fb_ssd1331.ko
/lib/modules/3.8.13-bone50/extra/fb_ssd1306.ko
/lib/modules/3.8.13-bone50/extra/fb_hx8353d.ko
/lib/modules/3.8.13-bone50/extra/fb_st7735r.ko
/lib/modules/3.8.13-bone50/extra/flexfb.ko
/lib/modules/3.8.13-bone50/extra/fb_ili9320.ko
/lib/modules/3.8.13-bone50/extra/fb_ssd1289.ko
/lib/modules/3.8.13-bone50/extra/fb_s6d02a1.ko
/lib/modules/3.8.13-bone50/extra/fbtft.ko
root@beaglebone:~# sudo depmod
root@beaglebone:~# 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)
## Uncomment to disable HDMI and eMMC:
root@beaglebone:~# vi /boot/uboot/uEnv.txt
##BeagleBone Black:
##Disable HDMI/eMMC
cape_disable=capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN,BB-BONE-EMMC-2G
## Add line to enable SPIDEV1:
cape_enable=capemgr.enable_partno=BB-SPIDEV1
## REBOOT BEAGLEBONE
##################################################
## LOAD FBTFT DRIVER
##################################################
## Verify which capes are loaded
rot@beaglebone:~# 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
#############################
## LOAD the driver for Adafruit 1.8" TFT LCD display connected to SPI1
root@beaglebone:~# modprobe fbtft_device busnum=1 name=adafruit18 debug=7 verbose=3 gpios=dc:48,reset:60
## fb0 device should now exist
root@beaglebone:~# ls -lsda /dev/fb*
0 crw-rw---T 1 root video 29, 0 Oct 30 06:27 /dev/fb0
## CONSOLE SHOULD NOW BE DISPLAYED ON THE LCD
Drew's photos of fbtft working for 1.8" & 2.2" TFT LCDs
https://plus.google.com/photos/+DrewFustini/albums/6211546193314906001
#############################
## LOAD driver for Adafruit 2.2" TFT LCD
## reboot & log in
## NOTE: "a" suffix is important in "adafruit22a"
root@beaglebone:~# modprobe fbtft_device busnum=1 name=adafruit22a debug=7 verbose=3 gpios=dc:48,reset:60
## 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
############################################
## TEST FBTFT DRIVERS
############################################
Based on:
https://github.com/notro/fbtft/wiki/Framebuffer-use
root@beaglebone:~# apt-get update
<snip>
Reading package lists... Done
W: There is no public key available for the following key IDs:
9D6D8F6BC857C906
W: There is no public key available for the following key IDs:
7638D0442B90D010
W: There is no public key available for the following key IDs:
7638D0442B90D010
## Fix public key ID warning
root@beaglebone:~# apt-get install debian-keyring debian-archive-keyring
root@beaglebone:~# apt-get update
root@beaglebone:~# apt-get install fbi
root@beaglebone:~# wget https://kernel.org/theme/images/logos/tux.png
root@beaglebone:~# 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 SHOULD BE DISPLAYED ON THE LCD NOw
Drew's photos of fbtft working for 1.8" & 2.2" TFT LCDs
https://plus.google.com/photos/+DrewFustini/albums/6211546193314906001
#######################################
### PLAY VIDEO
#######################################
root@beaglebone:~# apt-get install mplayer
root@beaglebone:~# wget http://fredrik.hubbe.net/plugger/test.mpg
root@beaglebone:~# 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment