[2024 DigiKey Creative Competition] 1. Raspberry Pi 5 drives ILI9488 image display
[Copy link]
This post was last edited by cszzlsw on 2024-9-22 00:33
1. Introduction
I actually received the RaspberryPi5 kit, 8G version, and I was so happy to get it. Since then, I have started to tinker with it. Actually, I have been wondering where to start. Later, I found that I had a screen that was compatible with the Raspberry Pi pins, so I turned on the screen first.
2. Preparation
To light up the screen, you need to prepare: Raspberry Pi (use the official power supply, and if possible, add a heat sink), SD card (32G or above is recommended for later data storage), touch screen (using ILI9488 driver chip, SPI protocol, 320*480 resolution, ft6236 touch chip, I2C protocol), Raspberry Pi 5 dedicated serial cable and appropriate adapter cable. After assembly, it looks like this:
The radiator here is an official one bought from Taobao. It can automatically adjust the speed according to the chip temperature, and its main purpose is to save energy and reduce emissions.
3. Download and burn the system
There is actually nothing much to say about this step. Just refer to some online posts and use the official tool (RapberryPi Imager) to download the official system and burn the firmware to the SD card.
In the official tool, you can configure the WIFI name, password, account name and password that you need to connect to, which is very convenient.
Then after the system starts, it will automatically connect to the corresponding wifi (or use a network cable), and you can use the raspi-config command to direct the system log to the serial port, so you don't have to wait for the system to connect to the network every time. At the same time, you need to buy a serial port cable compatible with the official interface of Raspberry Pi 5 online, and then you can have fun.
4. Touch screen pin definition:
First, check out the pinout of the Raspberry Pi:
My screen model: ILI9488, touch chip is FT6236, wiring is:
BCM Code Function
10 MOSI
9 MISO
11 SCLK
24 DC
25 BL
16 RESET
2 SDA
3 SCL
11 CTP_INT
5. Operation steps
5.1 Enable SPI
Add to the file /boot/firmware/config.txt: (the old system is /boot/config.txt, the new system has been modified)
dtparam=spi=on
5.2 Add corresponding driver and compile firmware
- Download the Linux system of Raspberry Pi and transplant the fb_ili9488.c file
URL:
After downloading, transfer it to the Raspberry Pi's file system, unzip it, and then enter the corresponding directory
- make bcm2712_defconfig
- make menuconfig
- Select fb and set it to true
- make -j4 zImage : can compile system firmware, deprecated, directly make to generate all content
- make -j4 modules : compile modules
- make dtbs : compile device tree
- make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install INSTALL_MOD_PATH=/opt/install/rpi-4.9 compile kernel image
- Modification of ili9488 code in fbtft
- Copy the fb_ili9486.c file in linux-stable_20240529/drivers/staging/fbtft/ to fb_ili9488.c and add relevant code
You also need to modify the fbtft.h file and fbtft-core.c file
Modify the Makefile file synchronously
Also add compilation to menuconfig
2. After the file is created, start the compilation make, and the newly compiled fb_ili9488.ko and fbtft.ko appear in drivers/staging/fbtft
3. Use xz -zk drivers/staging/fbtft/fbtft.ko file to generate fbtft.ko.xz file, and then use cp command to copy ko and ko.xz files to /lib/modules/6.6.31+rpt-rpi-2712/kernel/drivers/staging/fbtft, the same for fb_ili9488
4. Note that the generation of the mod requires modifying the CONFIG_LOCALVERSION content in .config to: "+rpt-rpi-2712"
5.3 Modify the device tree
- Open the /root/linux-stable_20240529/arch/arm64/boot/dts/overlays/fbtft-overlay.dts file and find the location of ili9341:
-
Change to ili9488 related content, and add the properties of the device tree:
- Then use make dtbs to generate the device tree
- Copy the generated fbtft.dtbo to /boot/overlays
- Then modify /boot/firmware/config.txt and add dt content
- After booting, you can see the relevant log in dmesg:
- If the connection is correct, the screen should light up
The effect is as follows:
- Watch the video to experience the startup process
|