-
Notifications
You must be signed in to change notification settings - Fork 2
Home
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" />
- Supported LCD modules
- LCD Shields (Recommended: 2.8" TFT + Touch Shield Board)
- Step-by-step using FBTFT
- Install
- Using fbtft_device
- Framebuffer use
- Debug
- Backlight
- Touchpanel
- Source code
For a list of all wikipages see Pages
Raspberry Pi kernel with FBTFT support: https://github.com/notro/rpi-firmware
rpi-update is used to install this kernel. Thanks to straccio for the idea.
To use rpi-update it has to be the latest version (auto updating doesn't work, since it overwrites the REPO_URI variable):
sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
Remember to expand the filesystem if you haven't done so
sudo raspi-config
If you use raspian and need SPI, remember to enable it
# remove or comment out the spi blacklist line
sudo nano /etc/modprobe.d/raspi-blacklist.conf
Install
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
sudo shutdown -r now
A particular commit can be installed like this (preferred method on a slow network connection: Use wget/zip instead of Git):
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update f5fda53ad421799c7266310d87045cab0b525dec
-
2013-11-18 (d0f11a458c49057afd8e069f83da2ad029b70c82)
- fb_ssd1306: add support for Adafruit OLED 1.3" monochrome display
- fb_ili9340: add support for the new Adafruit 2.2" display
- Enable console rotation support (fbcon=rotate:1)
-
2013-09-18 (bf227f608bfefb6d8046b3b841d07066c26367e4)
- fbtft: fix performance debug output
- flexfb: add 9-bit SPI emulation support
- fb_watterott: add support for mi0283qt-v2
- fbtft: experimental DMA support
- fbtft: turn off backlight before device removal
Thanks to Derek Campbell (guzunty) there is now experimental DMA support for SPI in FBTFT.
The CPU runs much lighter using DMA (test).
If you run your display at max speed, you might need to lower that, because of less latency (time for the controller to catch up).
Because it's experimental, DMA has to be enabled (this command won't take effect if fbtft is already loaded):sudo modprobe fbtft dma
Verify that DMA is enabled by looking at the dmesg output (will say 4KiB buffer memory if DMA is not enabled):
dmesg graphics fb1: fb_ili9320 frame buffer, 320x240, 150 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi0.0 at 32 MHz
To make DMA work, a DMA capable SPI master driver was needed. Luckily Martin Sperl has made one. I have forked that driver and made some changes.
-
2013-09-03 (761e74acea69c2ae4d503cac8c529273babfef4c)
- fbtft_device: Add support for Freetronics OLED128 module and Tianma TM022HDH26
- fb_ssd1351: added chip gpio support (backlight)
- ads7846_device: moved to notro/fbtft_tools
- fbtft: add active low backlight pinname: 'led_'
-
2013-08-22 (f5fda53ad421799c7266310d87045cab0b525dec)
- All drivers have been rewritten (except flexfb). They now contain only LCD Controller specific logic and a default init sequence. fbtft_device contains the display specific information.
Show supported displays like thissudo modprobe fbtft_device name=list; dmesg | tail -30
- rotate argument is now a conter clockwise angle: 0, 90, 180, 270
- All drivers support all interface modes: SPI 8-bit + D/C, 8-bit + startbyte, 9-bit, GPIO 8, 16 bit (even though the LCD controller might not).
- The drivers will also load automatically when the device is present (need only load fbtft_device).
- The init sequence can be overridden on all drivers with the fbtft_device init argument.
- All drivers have been rewritten (except flexfb). They now contain only LCD Controller specific logic and a default init sequence. fbtft_device contains the display specific information.
Raspberry Pi images with FBTFT support
Before using rpi-update
or apt-get upgrade
, see issue
-
2013-05-25-wheezy-raspbian-2013-07-07-fbtft.zip
- The Sticky keys issue is resolved (for me at least).
- 'rotate' is now a device argument for all drivers.
- 16-bit latched is not tested.
Changes - fbtft: gamma correction support, fix 16-bit databus write function
- fbtft_device: added 'chip' argument
- itdb28fb: gamma support
- nokia3310fb: added console support
- sainsmart32fb: fix 16-bit databus support
- ssd1351fb: added
-
2013-05-25-wheezy-raspbian-2013-06-14-fbtft.zip
- Issue: Sticky keys
- Issue: 16-bit databus support is not working.
-
ads7846_test is now ads7846_device (no driver included). It's the same arguments, but ads7846 also has to be loaded.
Changes - fbtft - added device support for 'rotate' and 'bgr', fixes fbtft_set_addr_win() for values > 255. Thanks cnvogelg., make it possible to disable tx buffer with txbuflen < -1, experimental 16-bit bus support, moved EXPORT_SYMBOL statements, add Start byte support, add fbtft_read_spi(), added fbtft_write_gpio16_wr_latched()
- fbtft_device - added rotate and bgr arguments, add buswidth=16 support
- flexfb: don't check 'dc' gpio when using startbyte
- ads7846_test: (removed)
- ads7846_device: added
- sainsmart18fb: add backlight support
- sainsmart32fb: use device 'rotate' argument, add 16-bit support
- ili9341fb - added rotation support
- hy28afb: added
- See Changelog for previous images
Using the Adafruit 2.2" display as an example
-
Register device (the driver will load automatically)
dmesg will show the default pin assignements, and that the driver is loaded.
sudo modprobe fbtft_device name=adafruit22
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
-
X Windows
FRAMEBUFFER=/dev/fb1 startx
-
Console
con2fbmap 1 1
-
Driver
Add to file /etc/modulesfbtft_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 &"
-
Console at boot
Add kernel argument to file/boot/cmdline.txt
fbcon=map:10
For more: Boot console
-
Driver
Add to file /etc/modules-load.d/raspberrypi.confAdd to file /etc/modprobe.d/fbtft.conffbtft_device
options fbtft_device name=adafruit22
If you find bugs or have problems, please submit an issue.
For the Raspberry Pi, the Other projects forum can be used to discuss these kinds of displays.
If you want to help out with my cost for displays and other accessories related to this project: Donate