Skip to content

LCD (SPI) Panel Connection

Timo Kokkonen edited this page Mar 19, 2023 · 17 revisions

Starting firmware version 1.4.0 Fanpico-0804D boards support SPI LCD displays via J18 connector.

lcd-2inch-ips

Supported Displays

Currently only 320x240 (or 240x320) resolution displays are supported. Larger screens should work but whole display is not used (support for larger resolutions shouldn't be difficult to add)

LCD Controller (Chip) Resolution Notes
ILI9341 240x320 Tested OK. ("SYS:DISP lcd=ILI9341")
ST7789 240x320 Tested OK. ("SYS:DISP lcd=ST7789")
ILI9486 320x480 (8bit SPI mode) Not tested.
ILI9486_RPI 320x480 (16bit SPI mode). Panels meant for Raspberry Pi GPIO header usually require 16bit SPI mode. Tested OK on a Waveshare (clone?) panel. ("SYS:DISP lcd=ILI9486_RPI")
HX8357 320480 Not tested.

Configure LCD Display

By default I2C bus (for OLED display) TTL Serial (UART) are active. Since SPI shares pins with I2C and UART those connectors cannot be used when there is LCD Display connected to connector J18.

To configure LCD Display we must activate SPI mode (this explicitly disables I2C and UART) and configure the type of LCD panel that is connected.

For example to use generic ILI9341 based LCD module following:

SYS:SPI 1
SYS:DISP lcd=ILI9341
CONF:SAVE
*RST

Configuring Additional Options

Some display modules may require additional settings to work properly (to fix colors, orientation, etc).

For example, it is possible to rotate screen:

SYS:DISP lcd=ILI9341,rotate=270

Or swap red and green colors if colors don't display correctly:

SYS:DISP lcd=ILI9341,swapcolors

See SYS:DISP for more details.

SPI Display Connection

NOTE! When using SPI connector, OLED display connector(s) and Serial TLL connector cannot be used at the same time, since I2C/UART share same pins as the SPI on connector J18.

J18 Pin LCD Panel Pin Description
1 DC Data/Command selector pin
2 Vcc / Vin 3.3V DC power for the LCD display
3 SCK SPI Clock Input pin
4 MOSI SPI Microcontroller Out Serial In pin
5 CS SPI Chip Select
6 GND Ground
7 LED / BL Display Backlight
8 RST Display Reset

NOTE current PCBs only have 6-pin connector (future ones are planned to include 8-pin connector). When using SPI LCD panel on current boards it may be necessary connect Vcc (pin 2) to RST and LED pins on the LCD display (unless display has built-in pull up resistors on those pins).

j18-connector2