Skip to content

Configure TFT Screen (Older versions of Rasbian)

Richard Goodwin edited this page Feb 25, 2021 · 2 revisions

Older versions of Raspbian included the FBTFT Driver written by Notro however, as part of an ongoing move to adopt systemd, you are encouraged to use Device Tree Overlays instead and in fact, starting with Debian built using the v4.5 Linux Kernel onwards, the fbtft_device has been dropped altogether.

So, the instructions below should now be considered legacy. Instead, follow these

Legacy instructions for installing the fbtft_driver

Load the Frame Buffer TFT driver:

sudo nano /etc/modules-load.d/modules.conf

add the following 2 lines at the end of the file:

spi-bcm2835
fbtft_device

Save and Exit: CTRL+X

Edit the config.txt file to change the default HDMI output to match the aspect ratio of the TFT, and to make sure the SPI and I2C busses are enabled.

sudo nano /boot/config.txt

Make sure the following lines are un-commented:

dtparam=i2c_arm=on
dtparam=spi=on

Add the following lines beneath the line that says #framebuffer_height=720

framebuffer_width=1280
framebuffer_height=960
hdmi_group=2
hdmi_mode=32
hdmi_cvt 1280 960 60 1 0 0 0

Add the following lines to the bottom of the file - the first prevents the Pi displaying the 'lightning flash' power warning in the top right of the screen, the second adds the touchscreen overlay and the final line increases the i2c bus speed from the default of 100KHz to 400KHz

avoid_warnings=1
dtoverlay=ads7846,penirq=17,speed=1600000,xohms=100
dtparam=i2c_baudrate=400000

Save and Exit: CTRL+X

Load the TFT drivers at boot time

sudo nano /etc/modprobe.d/fbtft.conf

In this file, add the following line:

options fbtft_device custom name=fb_ili9340 buswidth=8 speed=16000000 bgr=1 gpios=reset:27,dc:22 rotate=270

Save and Exit: CTRL+X

If you now reboot the Pi, the TFT drivers should load:

sudo reboot

Test that the TFT drivers are working by moving the console to the TFT Screen:

con2fbmap 1 1

And back again:

con2fbmap 1 0