Skip to content
Noralf Trønnes edited this page Jan 7, 2020 · 27 revisions

Generic driver for various LCD Controllers.

Note: flexfb is not available starting from Linux 5.4

This driver tries to be a solution for the many LCD Controllers available, without having to write drivers for them all.
One strength is that it is runtime configurable. Download image and start using with an "unsupported" display.

The driver supports both SPI devices: flexfb and platform devices: flexpfb. fbtft_device has support for both.

Parameters

  • chip
    Supported: st7735r, hx8340bn, ili9225, ili9320, ili9325, ili9341, ssd1289, ssd1351
    Provides defaults for height, width, regwidth, set_addr_win, and init
    See source for details
  • height
    Display height
  • width
    Display width
  • init
    Init sequence Markers: -1: command begin, -2: millisecond delay, -3: end of init sequence
    No spaces allowed
  • setaddrwin
    Which set_addr_win() implementation to use
    0 - st7735r, hx8340
    1 - ili9320, ili9325
    2 - ssd1289
    3 - ssd1351
  • buswidth
    Width of databus (default: 8)
  • regwidth
    Width of controller register (default: 8)
  • nobacklight
    Turn off backlight functionality.

TFT01-2.4 (S6D1121)

Product page: http://www.elecfreaks.com/store/24-tft-lcd-tft0124-p-110.html
Forum post: http://www.raspberrypi.org/phpBB3/viewtopic.php?p=403023#p403023

Register 0x0003 controls rotation: 0=0x0003, 1=0x000A, 2=0x0000, 3=0x0009

sudo modprobe fbtft_device name=flexpfb rotate=3
sudo modprobe flexfb width=240 height=320 regwidth=16 setaddrwin=1 init=-1,0x0013,0xCC00,-1,0x0011,0x2004,-1,0x0015,0x2600,-1,0x0014,0x252A,-1,0x0012,0x0033,-1,0x0013,0xCC04,-2,5,-1,0x0013,0xCC06,-2,5,-1,0x0013,0xCC4F,-2,5,-1,0x0013,0x674F,-1,0x0011,0x2003,-2,5,-1,0x0030,0x2609,-1,0x0031,0x242C,-1,0x0032,0x1F23,-1,0x0033,0x2425,-1,0x0034,0x2226,-1,0x0035,0x2523,-1,0x0036,0x1C1A,-1,0x0037,0x131D,-1,0x0038,0x0B11,-1,0x0039,0x1210,-1,0x003A,0x1315,-1,0x003B,0x3619,-1,0x003C,0x0D00,-1,0x003D,0x000D,-1,0x0016,0x0007,-1,0x0002,0x0013,-1,0x0003,0x0009,-1,0x0001,0x0127,-2,5,-1,0x0008,0x0303,-1,0x000A,0x000B,-1,0x000B,0x0003,-1,0x000C,0x0000,-1,0x0041,0x0000,-1,0x0050,0x0000,-1,0x0060,0x0005,-1,0x0070,0x000B,-1,0x0071,0x0000,-1,0x0078,0x0000,-1,0x007A,0x0000,-1,0x0079,0x0007,-1,0x0007,0x0051,-2,5,-1,0x0007,0x0053,-1,0x0079,0x0000,-3

Sainsmart 1.8" (ST7735R)

Emulating sainsmart18fb

modprobe fbtft_device name=flexfb
modprobe flexfb width=128 height=160 init=-1,0x01,-2,150,-1,0x11,-2,500,-1,0xB1,0x01,0x2C,0x2D,-1,0xB2,0x01,0x2C,0x2D,-1,0xB3,0x01,0x2C,0x2D,0x01,0x2C,0x2D,-1,0xB4,0x07,-1,0xC0,0xA2,0x02,0x84,-1,0xC1,0xC5,-1,0xC2,0x0A,0x00,-1,0xC3,0x8A,0x2A,-1,0xC4,0x8A,0xEE,-1,0xC5,0x0E,-1,0x20,-1,0x36,0xC0,-1,0x3A,0x05,-1,0xE0,0x0f,0x1a,0x0f,0x18,0x2f,0x28,0x20,0x22,0x1f,0x1b,0x23,0x37,0x00,0x07,0x02,0x10,-1,0xE1,0x0f,0x1b,0x0f,0x17,0x33,0x2c,0x29,0x2e,0x30,0x30,0x39,0x3f,0x00,0x07,0x03,0x10,-1,0x29,-2,100,-1,0x13,-2,10,-3

Register 0x36 controls rotation and rgb/bgr.

Sainsmart 3.2" (SSD1289)

Emulating sainsmart32fb
Use SPI interface circuit

modprobe fbtft_device name=flexfb rotate=0 speed=16000000 gpios=reset:25,dc:24
modprobe flexfb debug=3 width=240 height=320 regwidth=16 setaddrwin=2 init=-1,0x00,0x0001,-1,0x03,0xA8A4,-1,0x0C,0x0000,-1,0x0D,0x080C,-1,0x0E,0x2B00,-1,0x1E,0x00B7,-1,0x01,0x2B3F,-1,0x02,0x0600,-1,0x10,0x0000,-1,0x11,0x6070,-1,0x05,0x0000,-1,0x06,0x0000,-1,0x16,0xEF1C,-1,0x17,0x0003,-1,0x07,0x0233,-1,0x0B,0x0000,-1,0x0F,0x0000,-1,0x41,0x0000,-1,0x42,0x0000,-1,0x48,0x0000,-1,0x49,0x013F,-1,0x4A,0x0000,-1,0x4B,0x0000,-1,0x44,0xEF00,-1,0x45,0x0000,-1,0x46,0x013F,-1,0x30,0x0707,-1,0x31,0x0204,-1,0x32,0x0204,-1,0x33,0x0502,-1,0x34,0x0507,-1,0x35,0x0204,-1,0x36,0x0204,-1,0x37,0x0502,-1,0x3A,0x0302,-1,0x3B,0x0302,-1,0x23,0x0000,-1,0x24,0x0000,-1,0x25,0x8000,-1,0x4f,0x0000,-1,0x4e,0x0000,-1,0x22,-3

Register 0x11 controls rotation: 0=0x6070, 1=0x6068, 2=0x6040, 3=0x6058
Landscape example

modprobe fbtft_device name=flexfb rotate=1 speed=16000000 gpios=reset:25,dc:24
modprobe flexfb debug=3 width=240 height=320 regwidth=16 setaddrwin=2 init=-1,0x00,0x0001,-1,0x03,0xA8A4,-1,0x0C,0x0000,-1,0x0D,0x080C,-1,0x0E,0x2B00,-1,0x1E,0x00B7,-1,0x01,0x2B3F,-1,0x02,0x0600,-1,0x10,0x0000,-1,0x11,0x6068,-1,0x05,0x0000,-1,0x06,0x0000,-1,0x16,0xEF1C,-1,0x17,0x0003,-1,0x07,0x0233,-1,0x0B,0x0000,-1,0x0F,0x0000,-1,0x41,0x0000,-1,0x42,0x0000,-1,0x48,0x0000,-1,0x49,0x013F,-1,0x4A,0x0000,-1,0x4B,0x0000,-1,0x44,0xEF00,-1,0x45,0x0000,-1,0x46,0x013F,-1,0x30,0x0707,-1,0x31,0x0204,-1,0x32,0x0204,-1,0x33,0x0502,-1,0x34,0x0507,-1,0x35,0x0204,-1,0x36,0x0204,-1,0x37,0x0502,-1,0x3A,0x0302,-1,0x3B,0x0302,-1,0x23,0x0000,-1,0x24,0x0000,-1,0x25,0x8000,-1,0x4f,0x0000,-1,0x4e,0x0000,-1,0x22,-3

Adafruit 2.2" (HX8340bn)

Emulating adafruit22fb (no 9-bit emulation support).

modprobe fbtft_device name=flexfb
modprobe flexfb width=176 height=220 buswidth=9 init=-1,0xC1,0xFF,0x83,0x40,-1,0x11,-2,150,-1,0xCA,0x70,0x00,0xD9,-1,0xB0,0x01,0x11,-1,0xC9,0x90,0x49,0x10,0x28,0x28,0x10,0x00,0x06,-2,20,-1,0xC2,0x60,0x71,0x01,0x0E,0x05,0x02,0x09,0x31,0x0A,-1,0xC3,0x67,0x30,0x61,0x17,0x48,0x07,0x05,0x33,-2,10,-1,0xB5,0x35,0x20,0x45,-1,0xB4,0x33,0x25,0x4C,-2,10,-1,0x3A,0x05,-1,0x29,-2,10,-3

Register 0x36 controls rotation and rgb/bgr.

ITDB02-2.8 (ILI9325)

Emulating itdb28fb

modprobe fbtft_device name=flexpfb
modprobe flexfb width=240 height=320 regwidth=16 setaddrwin=1 init=-1,0x00E3,0x3008,-1,0x00E7,0x0012,-1,0x00EF,0x1231,-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0223,-2,50,-1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000C,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0506,-1,0x0032,0x0104,-1,0x0035,0x0207,-1,0x0036,0x000F,-1,0x0037,0x0306,-1,0x0038,0x0102,-1,0x0039,0x0707,-1,0x003C,0x0702,-1,0x003D,0x1604,-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0xA700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0600,-1,0x0007,0x0133,-3

Register 0x0003 controls rotation: 0=0x1030, 1=0x1028, 2=0x1000, 3=0x1018
Landscape example

modprobe fbtft_device name=flexpfb rotate=1
modprobe flexfb width=240 height=320 regwidth=16 setaddrwin=1 init=-1,0x00E3,0x3008,-1,0x00E7,0x0012,-1,0x00EF,0x1231,-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1028,-1,0x0004,0x0000,-1,0x0008,0x0207,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-2,200,-1,0x0010,0x1690,-1,0x0011,0x0223,-2,50,-1,0x0012,0x000D,-2,50,-1,0x0013,0x1200,-1,0x0029,0x000A,-1,0x002B,0x000C,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0506,-1,0x0032,0x0104,-1,0x0035,0x0207,-1,0x0036,0x000F,-1,0x0037,0x0306,-1,0x0038,0x0102,-1,0x0039,0x0707,-1,0x003C,0x0702,-1,0x003D,0x1604,-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0xA700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0600,-1,0x0007,0x0133,-3

Watterott MI0283QT-9 (ILI9341)

Emulating ili9341fb
Blog post: http://lallafa.de/blog/2013/06/watterott-mi0283qt-9-display-with-generic-flexfb-driver/

modprobe fbtft_device name=flexfb gpios=reset:25,led:18
modprobe flexfb width=320 height=240 buswidth=9 init=\
-1,0x28,-2,20,-1,0xCF,0x00,0x83,0x30,-1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x01,0x79,\
-1,0xCB,0x39,0x2c,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00,-1,0xC0,0x26,-1,0xC1,0x11,\
-1,0xC5,0x35,0x3E,-1,0xC7,0xBE,-1,0xB1,0x00,0x1B,-1,0xB6,0x0a,0x82,0x27,0x00,-1,0xB7,0x07,\
-1,0x3A,0x55,-1,0x36,0x38,-1,0x11,-2,120,-1,0x29,-2,20,-3

Or for an ILI9341 in 8-Bit SPI mode

modprobe fbtft_device name=flexfb gpios=dc:22,reset:23,led:24
modprobe flexfb width=320 height=240 buswidth=8 init=\
-1,0x28,-2,20,-1,0xCF,0x00,0x83,0x30,-1,0xED,0x64,0x03,0x12,0x81,-1,0xE8,0x85,0x01,0x79,\
-1,0xCB,0x39,0x2c,0x00,0x34,0x02,-1,0xF7,0x20,-1,0xEA,0x00,0x00,-1,0xC0,0x26,-1,0xC1,0x11,\
-1,0xC5,0x35,0x3E,-1,0xC7,0xBE,-1,0xB1,0x00,0x1B,-1,0xB6,0x0a,0x82,0x27,0x00,-1,0xB7,0x07,\
-1,0x3A,0x55,-1,0x36,0x38,-1,0x11,-2,120,-1,0x29,-2,20,-3

HY28A (ILI9320)

Emulating hy28afb

modprobe fbtft_device name=flexfb startbyte=0x70 mode=3
modprobe flexfb width=240 height=320 regwidth=16 setaddrwin=1 init=-1,0x00E5,0x8000,-1,0x0000,0x0001,-1,0x0001,0x0100,-1,0x0002,0x0700,-1,0x0003,0x1030,-1,0x0004,0x0000,-1,0x0008,0x0202,-1,0x0009,0x0000,-1,0x000A,0x0000,-1,0x000C,0x0000,-1,0x000D,0x0000,-1,0x000F,0x0000,-1,0x0010,0x0000,-1,0x0011,0x0007,-1,0x0012,0x0000,-1,0x0013,0x0000,-2,200,-1,0x0010,0x17B0,-1,0x0011,0x0031,-2,50,-1,0x0012,0x0138,-2,50,-1,0x0013,0x1800,-1,0x0029,0x0008,-2,50,-1,0x0020,0x0000,-1,0x0021,0x0000,-1,0x0030,0x0000,-1,0x0031,0x0505,-1,0x0032,0x0004,-1,0x0035,0x0006,-1,0x0036,0x0707,-1,0x0037,0x0105,-1,0x0038,0x0002,-1,0x0039,0x0707,-1,0x003C,0x0704,-1,0x003D,0x0807,-1,0x0050,0x0000,-1,0x0051,0x00EF,-1,0x0052,0x0000,-1,0x0053,0x013F,-1,0x0060,0x2700,-1,0x0061,0x0001,-1,0x006A,0x0000,-1,0x0080,0x0000,-1,0x0081,0x0000,-1,0x0082,0x0000,-1,0x0083,0x0000,-1,0x0084,0x0000,-1,0x0085,0x0000,-1,0x0090,0x0010,-1,0x0092,0x0000,-1,0x0093,0x0003,-1,0x0095,0x0110,-1,0x0097,0x0000,-1,0x0098,0x0000,-1,0x0007,0x0173,-3

ILI9341

Datasheet: http://www.displaytech-us.com/sites/default/files/driver-ic-data-sheet/ILI9341_DS_V1.10_20110415.pdf
Application notes: http://focuslcd.com/wp/wp-content/uploads/2012/10/ILI9341_AN_V0.9.pdf

piwik