element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • Experts & Guidance
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • 'Choose another store...'
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
BeagleBoard
  • Products
  • Dev Tools
  • Single-Board Computers
  • BeagleBoard
  • More
  • Cancel
BeagleBoard
Blog BeagleBone Black: build fbtft drivers for latest Linux 3.8 kernel
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
BeagleBoard requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fustini
  • Date Created: 19 Nov 2015 1:36 AM Date Created
  • Views 919 views
  • Likes 1 like
  • Comments 3 comments
  • fbtft
  • beaglebone_black
  • open_source
  • oshw
  • bbb
  • BeagleBone
  • kernel
  • open_hardware
  • adafruit
  • linux
Related
Recommended

BeagleBone Black: build fbtft drivers for latest Linux 3.8 kernel

fustini
fustini
19 Nov 2015

image

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:

image

image

image

image

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:

  • Debian (BeagleBone, BeagleBone Black - 4GB SD) 2015-03-01
    • md5: c848627722b7a5f7bc89791cc8949e3b

 

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:

  • https://gist.github.com/pdp7/ce4a3deb43f3e7e0214d
  • https://gist.github.com/pdp7/c3ecf2cf4b39a62a4192


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:

  • https://gist.github.com/pdp7/c62f54573992dfafd003

 

Links

  • FBTFT on BeagleBone Black running Debian
  • FBTFT Wiki
  • FBTFT drivers are now in the Linux kernel staging tree
    • Development in the github repo has ceased
  • My photos of fbtft working for 1.8" & 2.2" TFT LCDs
  • My screenshots of kernel config for fbtft drivers in BeagleBone kernel v3.8.13
  • Sign in to reply

Top Comments

  • balearicdynamics
    balearicdynamics over 7 years ago +1
    Hi Drew, very good tutorial and presentation. Just an issue, no idea if it is a local problem here; the last large images step1, step2, step3 are not shown. Enrico
  • fustini
    fustini over 7 years ago in reply to DAB

    thanks DAB & Enrico.  I've uploaded the images again and hopefully that works.  There is one at the top with Tux on the LCD wired to BBB, and then there is a set of 4 that show the kernel config menus.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 7 years ago

    Hi Drew,

     

    I had no images past the first couple.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • balearicdynamics
    balearicdynamics over 7 years ago

    Hi Drew,

     

    very good tutorial and presentation. Just an issue, no idea if it is a local problem here; the last large images step1, step2, step3 are not shown.

     

    Enrico

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube