Sunday, 2 February 2020

2.8 TFT SPI ILI-9341 Display R-PI and BBB

2.8 TFT SPI ILI-9341 Display R-PI and BBB

Post by marius » Mon Sep 23, 2019 10:43 pm
Purchased this display: ILI9341 2.8 inch SPI TFT LCD Display Touch Panel 240x320 with PCB


RPI


Wiring:
Code: Select all
Display--------- Raspberry Pi
BL-------------- pin 12 (GPIO 18)
SCK------------- pin 23 (GPIO 11)
MISO------------ pin 21 (GPIO 9)
MOSI------------ pin 19 (GPIO 10)
CS-------------- pin 24 (GPIO 8)
RST------------- pin 22 (GPIO 25)
D/C------------- pin 18 (GPIO 24)
VIN------------- pin 17 (3.3v)
GND------------- pin 20 (GND)
Drawbacks: No EGL on SPI so far. I guess I need a RGB bus.


Image

Then insert the driver
Code: Select all
sudo modprobe fbtft_device custom name=fb_ili9341  gpios=reset:25,dc:24,led:18 speed=16000000
Then activate
Code: Select all
con2fbmap 1 1


BBB

Edit /boot/uEnv.txt and make sure this line is not commented
Code: Select all
disable_uboot_overlay_video=1
reboot

Wiring
Code: Select all
FUNC----BBBFUNC-------- PX_##------DISP-------BBBGPIO----- ILI-9341  TFT
5 V     power          P9_5        Vin       IF  display has 3.3v power regulator (OR NEXT)
3 V     power          P9_3        Vin       IF  display has 3.3v power in (reg strapped)
GND     pin            P8_2        GND       GND PIN
CS      SPI0_CS0       P9_17       CS        GPIO 4
RESET   GPIO_60        P9_12       RST       GPIO 60
DC      GPIO_48        P9_15       D/C       GPIO 48
MOSI    SPI0_D1        P9_18       MOSI      SPI 0 D1
SCLK    SPI0_SCLK      P9_22       CLK       SPI 0 CLK  (GPIO_2)
BL/LED  power          3V          LED/BL    3.3V   (no led power for now)
MISO    SPI0_D0        P9_21       MISO      SPI 0 D0
Image


Init script
Code: Select all
bbb@beaglebone:~/autostart$ cat 2-spis.sh 
#!/bin/bash

sleep 4
config-pin P9.17 spi_cs
config-pin P9_18 spi
config-pin P9_21 spi
config-pin P9.22 spi_sclk

sudo modprobe fbtft_device custom busnum=1 name=fb_ili9341 gpios=reset:60,dc:48 speed=16000000
sleep 1
echo -n -e '\e[?17;14;0c' > /dev/tty0                          # no cursor
echo 0 > /sys/class/graphics/fbcon/cursor_blink                # no blink
echo -n -e  '\e[3J' > /dev/tty0                                # clear display
echo -n -e  'HELLO BBB' > /dev/tty0    

Insert Module
Code: Select all
sudo modprobe fbtft_device custom name=fb_ili9341  gpios=reset:60,dc:48,cs:4,clk:2,led:20 speed=16000000

Image

No comments:

Post a Comment