I've been running network services on embedded arm platforms for for more than 8 years now, and when things go wrong, had to drag around HDMI monitors to hook up. For the last years I had a pi connected to the serial console to avoid that.
I have been mounting all my networking and smarthome devices on a DIN rail, and I had some small 2.2" TFT displays around for a different project.
I thought it would be nice to create a raspberry pi enclosure that included such a display so there's a real video console on the device that can also be used as status display.
I run Ubuntu 20.04 server on my PI4, and discovered there are already loadable kernel modules (drivers) for these tft displays in /lib/modules.
I couldn't find a suitable device tree blob, so I tweaked an existing one to make it work.
Tryout with raspbian
I found a very nice article on how to use the display on the internet: https://www.xgadget.de/anleitung/2-2-spi-display-ili9341-am-raspberry-betreiben/
I flashed a raspbian to an SD card and followed the instructions, this worked so I was sure the wiring and hardware is working ok.
I want to use this on Ubuntu by using device tree, so I needed a device tree blob.
I couldn't find an exact match on internet, but the pitft22a.dts file at
was close, so I modified it to use different pins and the 9341 instead of 9340.
On startup, this appears in the kernel debug log:
[ 9.027191] Console: switching to colour frame buffer device 30x40 [ 9.028488] graphics fb0: fb_ili9341 frame buffer, 240x320, 150 KiB video memory, 16 KiB buffer memory, fps=31, spi0.0 at 8 MHz
And presto, a tiny working video console appears on the TFT.
Next I gave this a try on Ubuntu 20.04 arm64. The kernel log shows the same message, but the TFT remains white.
I took logic traces for both, and the SPI bus looks functional in both cases, and the data mostly identical.
One big difference between the two setups is that Ubuntu is using a 64bit kernel 5.4, while raspbian is using a 32bit Linux 4.19.118-v7l+
Other than that, I tried playing with con2fbmap, and tried to start X11 on /dev/fb0, but no success.
To be continued...
Reference device tree source examples: https://github.com/notro/fbtft/blob/master/dts/rpi.dts