Adafruit PiTFT 2.4″ touchscreen on a Raspberry Pi Zero with Archlinux

July 30, 2017

adafruit
archlinux
linux
raspberry pi

While ago I bought the Adafruit PiTFT 2.4″ touchscreen HAT and I wanted to use it with my Rapsberry Pi Zero.

Unfortunately, it seems that Adafruit supports only the Raspian distribution while my favourite distro is Archlinux.

However, I managed to get the screen to work under Archlinux too:

adafruit_tft_raspberry_archlinux

From the Adafruit website we can find the kernel patch, so we can compile our kernel image that supports the screen.

However I wanted a quicker solution.

From the ArchlinuxARM forum, someone suggested to download the Adafruit OS image that supports another Adafruit screen, the 2.2” and copy the device tree overlay for the screen.

So I wanted to give this way a try.

Download the “ready to go image” from the Adafruit website and unzip it.

To mount the .img with mount, we need to know the offset first.

So we have to execute the command:

fdisk -l 2016-10-18-pitft-28r.img

From the output of fdisk, I saw that the block is 512 bytes while the start is 8192. So the offset is 512*8192 = 4194304.

So now we can mount with:

mount -o loop,offset=4194304 2016-10-18-pitft-28r.img pitft_image/

And in there there are indeed the .dtbo file that we are looking for:

adafruit_tft_dtbo_file

It seems that the 2.8” overlay works for the 2.4” too.

So we just copy it to the overlays folder under /boot/:

cp pitft_image/overlays/pitft28-resistive.dtbo /boot/overlays/

After that we need to edit the file /boot/config.txt so that the kernel will load the overlay. We need to add the following lines:

dtparam=i2c_arm=on<br /> dtparam=i2c_vc=on<br /> dtparam=spi=on<br /> dtoverlay=pitft28-resistive,rotate=90,speed=32000000,fps=20

Also, we need to edit the file /boot/cmdline.txt, adding some kernel parameters after rootwait:

rootwait fbcon=map:10 fbcon=font:VGA8x8 consoleblank=0

After this just reboot and the tft screen should work.