Driver supports:
- Display
- Backlight
- Touchscreen
Links:
- FBTFT source
- FBTFT wiki
- Display module product page
⚠ This driver uses a legacy rendering method.
Consider using the new DRM driver instead: https://github.com/v-kiniv/noritake-gud-drm
Get kernel source(change branch according to your current kernel version):
git clone --depth=1 --branch rpi-5.4.y https://github.com/raspberrypi/linux
Move FBTFT from staging to video:
mv ./linux/drivers/staging/fbtft ./linux/drivers/video
Copy fb_gud.c
to linux/drivers/video/fbtft
folder.
Update fbtft_device.c
, add this section to the struct fbtft_device_display displays[]
:
{
.name = "gud",
.spi = &(struct spi_board_info) {
.modalias = "fb_gud",
.max_speed_hz = 600000,
.mode = SPI_MODE_3,
.platform_data = &(struct fbtft_platform_data) {
.display = {
.buswidth = 8,
.backlight = FBTFT_ONBOARD_BACKLIGHT,
},
.fps=60,
.gpios = (const struct fbtft_gpio []) {
{ "reset", 17 },
{ "dc", 27 },
{},
},
}
}
}
Update Kconfig
, add this section before the config FB_TFT_FBTFT_DEVICE
entry:
config FB_TFT_GUD
tristate "FB driver for the Noritake GU-D Display"
depends on FB_TFT
help
Framebuffer support for Noritake GU-D
Update Makefile
, add this line to the end of the #drivers
section:
obj-$(CONFIG_FB_TFT_GUD) += fb_gud.o
make -j4 -C ~/linux SUBDIRS=drivers/video/fbtft modules
sudo insmod ~/linux/drivers/video/fbtft/fb_gud.ko
sudo insmod ~/linux/drivers/video/fbtft/fbtft_device.ko name=gud speed=600000 fps=60
Display should be connected using SPI interface. Check display datasheet for pinout reference and connect SPI pins to the according SPI pins on the RPI. Aside from SPI pins, there is also RESET and BUSY pins, those can be connected to arbitrary GPIO pins on RPI and then configured in default device configuration section
.gpios = (const struct fbtft_gpio []) {
{ "reset", 17 },// RESET pin on the display connected to RPI GPIO17
{ "dc", 27 }, // BUSY pin on the display connected to RPI GPIO27
{},
},
Or during module insertion into the kernel using insmod
command arguments.
SPI speed should not exceed 600KHz, so if your raspberry configured for various CPU speed, it may exceed the limit set in driver configuration as it gets multiplied along with CPU clock multiplier. So there is to options:
- set SPI speed below 600KHz, so when the system increases CPU clock multiplier, SPI speed does not exceed 600KHz - this option has downside of decreased FPS;
- lock CPU at fixed speed.