haphazard.io
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Raspberry Pi framebuffer FBTFT ILI9341

2.2" SPI TFT Display

2.2" SPI TFT Display

Wiring

Display Raspberry Pi GPIO
VCC 3.3V
GND GND
CS CEO
RESET 25
D/C 24
SDI (MOSI) MOSI
SCK SCLK
LED 18
SDO (MISO) n/a

Note: The above wiring scheme is the default GPIO values used by the fb_ili9341 TFT driver. These can be customized if required using the gpios parameter in /etc/modprobe.d/fbtft.conf.

Raspberry Pi Configuration

Reference: https://github.com/notro/fbtft/wiki

Create /etc/modules-load.d/fbtft.conf with the following:

spi-bcm2835
fbtft_device

Create /etc/modprobe.d/fbtft.conf with the following:

options fbtft_device name=fb_ili9341  gpios=reset:25,dc:24,led:18 speed=16000000 rotate=90 bgr=1

Note: If using a customized GPIO pinout, specify the GPIO values by adding the gpios parameter, eg: gpios=reset:25,dc:24,led:18

Reboot

Restart the Raspberry Pi by issuing a sudo restart. After the system reboots, the fbtft display module should be loaded. Verify by checking the output of dmesg, eg:

[    4.017261] fbtft: module is from the staging directory, the quality is unknown, you have been warned.
[    4.044138] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned.
[    4.072852] spi spi0.0: spidev spi0.0 125000kHz 8 bits mode=0x00
[    4.072868] spi spi0.1: spidev spi0.1 125000kHz 8 bits mode=0x00
[    4.072916] bcm2708_fb soc:fb: soc:fb id=-1 pdata? no
[    4.072997] spi spi0.0: Deleting spi0.0
[    4.075844] fbtft_device: GPIOS used by 'fb_ili9341':
[    4.075852] fbtft_device: 'reset' = GPIO25
[    4.075857] fbtft_device: 'dc' = GPIO24
[    4.075861] fbtft_device: 'led' = GPIO18
[    4.075880] spi spi0.1: spidev spi0.1 125000kHz 8 bits mode=0x00
[    4.075913] spi spi0.0: fb_ili9341 spi0.0 16000kHz 8 bits mode=0x00
[    4.851371] fb_ili9341: module is from the staging directory, the quality is unknown, you have been warned.
[    5.224848] graphics fb1: fb_ili9341 frame buffer, 320x240, 150 KiB video memory, 16 KiB DMA buffer memory, fps=20, spi0.0 at 16 MHz

A new framebuffer device /dev/fb1 should now be available.

$ ls -l /dev/fb*
crw-rw---- 1 root video 29, 0 Sep  9 02:39 /dev/fb0
crw-rw---- 1 root video 29, 1 Sep  9 02:55 /dev/fb1

Console

  • To utilize this display as the main console instead of the hdmi display, append fbcon=map:10 to /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=PARTUUID=4aa23984-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait fbtft_device.name=fb_ili9341 fbtft_device.gpios=reset:25,dc:24,led:18 fbtft_device.speed=16000000 fbtft_device.rotate=90 fbtft_device.bgr=1 fbtft_device.custom=1 fbcon=map:10

Change Font

2.2" SPI TFT Display

Backlight