Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
毛背心儿 edited this page May 2, 2015 · 159 revisions

Linux Framebuffer drivers for small TFT LCD display modules.

<img src="http://www.adafruit.com/images/ID797.jpg" title="Video: Raspberry Pi boots with Adafruit 2.2" LCD display" border="10" />

For a list of all wikipages see Pages

FBTFT development has moved
The FBTFT drivers are now in the Linux kernel: drivers/staging/fbtft (details).

Install

The FBTFT drivers are included in the Raspberry Pi Foundation kernel and can be installed with plain rpi-update.
There is one piece missing and that is a DMA capable SPI controller driver to get max performance. So for fbcp and showing movies, the FBTFT kernel still has to be used.

The following Device Tree Overlays are currently available:
hy28a, hy28b, mz61581, piscreen, pitft28-resistive (former pitft), rpi-display, tinylcd35

See /boot/overlays/README and FBTFT RPI overlays for more.

To use fbtft_device instead of a DT overlay, add to /boot/config.txt:

dtparam=spi=on

FBTFT kernel with SPI DMA

sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update

2015-03-27

  • FBTFT support is now in raspberrypi/linux. This release only adds SPI DMA support on top of that.

  • pitft overlay changed name to pitft28-resistive

  • These modules are no longer present:

    • gpio_keys_device - DT overlay example
    • ads7846_device - Use ads7846 DT overlay instead. See /boot/overlays/README
    • gpio_mouse_device
    • stmpe_device
    • gpio_backlight_device
    • rpi_power_switch
    • spi-config
  • Builtin console fonts are not enabled (fbcon=font:XX).

  • Other kconfig options no longer enabled:

    • MOUSE_GPIO
    • GPIO_MCP23S08
    • DYNAMIC_DEBUG
  • 2015-02-07

    • Add Raspberry Pi 2 support
  • Changelog

Missing kernel modules?

Use rpi-source to get the matching kernel source, making it easy to build modules.
Run like this:
REPO_URI=https://github.com/notro/rpi-firmware rpi-source
Examples on how to build various modules

Step-by-step using FBTFT

Using the Adafruit 2.2" display as an example

Enable driver

Register device (the driver will load automatically)
sudo modprobe fbtft_device name=adafruit22

dmesg will show the default pin assignements, and that the driver is loaded.

   fbtft_device:  SPI devices registered:
   fbtft_device:      spidev spi0.0 500kHz 8 bits mode=0x00
   fbtft_device:      spidev spi0.1 500kHz 8 bits mode=0x00
   fbtft_device:  'fb' Platform devices registered:
   fbtft_device:      bcm2708_fb id=-1 pdata? no
   fbtft_device: Deleting spi0.0
   fbtft_device:  GPIOS used by 'adafruit22':
   fbtft_device:    'reset' = GPIO25
   fbtft_device:    'led' = GPIO23
   fbtft_device:  SPI devices registered:
   fbtft_device:      spidev spi0.1 500kHz 8 bits mode=0x00
   fbtft_device:      fb_hx8340bn spi0.0 32000kHz 8 bits mode=0x00
   graphics fb1: fb_hx8340bn frame buffer, 176x220, 75 KiB video memory, 16 KiB buffer memory, fps=20, spi0.0 at 32 MHz

Test

X Windows
FRAMEBUFFER=/dev/fb1 startx

Note: You might need to move an xorg config out of the way if X doesn't start:

sudo mv /usr/share/X11/xorg.conf.d/99-fbturbo.conf ~
Console
con2fbmap 1 1

Make it permanent (Debian)

Driver

Add to file /etc/modules

fbtft_device name=adafruit22 verbose=0
Auto login and startx

Auto login: modify file /etc/inittab


#1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

Auto startx: modify file /etc/rc.local

su -l pi -c "env FRAMEBUFFER=/dev/fb1 startx &"

Ref: http://elinux.org/RPi_Debian_Auto_Login

Console at boot

Add kernel argument to file /boot/cmdline.txt

fbcon=map:10

For more: Boot console

Make it permanent (Arch Linux)

Add to file /etc/modules-load.d/raspberrypi.conf

spi_bcm2708
fbtft_device

Add to file /etc/modprobe.d/fbtft.conf

options fbtft_device name=adafruit22

If you find bugs or have problems, please submit an issue.

Thanks

Without the help from other people, this project would not exist

  • Matt Porter wrote st7735fb which FBTFT grew from
  • Texy has provided much input and testing that have helped move this project forward
  • Derek Campbell did the work to implement DMA
  • Several people have provided drivers and improvements
  • Donations have helped me buy displays and accessories

Also thanks to people that help answering questions about FBTFT.

piwik

Clone this wiki locally