Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.
notro edited this page Jun 4, 2013 · 27 revisions

Generic driver for various LCD Controllers.

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

  • height
    Display height (required)
  • width
    Display width (required)
  • init
    Init sequence (required)
    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
  • buswidth
    Width of databus (default: 8)
  • regwidth
    Width of controller register (default: 8)
  • nobacklight
    Turn off backlight functionality.
  • rotate (broken in the current image)
    Rotate display (0=normal, 1=clockwise, 2=upside down, 3=counterclockwise)
    This parameter applies only to setaddrwin=1
    Remember to swap width and height in 1 and 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)

Support for ssd1289 will be added in the upcoming image.
Use SPI interface circuit

modprobe fbtft_device name=flexfb speed=16000000 gpios=reset:25,dc:24
modprobe flexfb debug=3 width=240 height=320 rotate=0 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 flexfb debug=3 width=320 height=240 rotate=1 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 flexfb rotate=1 width=320 height=240 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

Emulating ili9341fb.c
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

ILI9320

Datasheet: http://www.techtoys.com.hk/Displays/TY240240320/ILI9320.pdf
Application notes: http://www.densitron.com/uploadedFiles/Displays/Support/ILI9320AN_V0.92.pdf

modprobe flexfb width=240 height=320 regwidth=16 setaddrwin=1 init=

Init sequence (from application note)
Power configuration will differ between displays. The values from the Application Notes has Vci=2.8V, but most display modules will have Vci=3.3V
See itdb28fb.c for ili9325 calculations.
Gamma curve also differs.

//*************Start Initial Sequence**********//
-1,0x00E5,0x8000,
-1,0x0000,0x0001,
-1,0x0001,0x0100,
-1,0x0002,0x0700,

RGB/BGR is set here
-1,0x0003,0x1030,

-1,0x0004,0x0000,
-1,0x0008,0x0202,
-1,0x0009,0x0000,
-1,0x000A,0x0000,
-1,0x000C,0x0000,
-1,0x000D,0x0000,
-1,0x000F,0x0000,
//*************Power On sequence****************//
-1,0x0010,0x0000,
-1,0x0011,0x0007,
-1,0x0012,0x0000,
-1,0x0013,0x0000,
-2,200,

The following 5 settings will differ between displays.
-1,0x0010,0x17B0,
-1,0x0011,0x0037,
-2,50,
-1,0x0012,0x013C,
-2,50,
-1,0x0013,0x1C00,
-1,0x0029,0x000E,
-2,50,

-1,0x0020,0x0000,
-1,0x0021,0x0000,
//-----------Adjust the Gamma Curve----------//
-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,

//------------------Set GRAMarea---------------//
-1,0x0050,0x0000,
-1,0x0051,0x00EF,
-1,0x0052,0x0000,
-1,0x0053,0x013F,
-1,0x0060,0x2700,
-1,0x0061,0x0001,
-1,0x006A,0x0000,
//--------------Partial Display Control---------//
-1,0x0080,0x0000,
-1,0x0081,0x0000,
-1,0x0082,0x0000,
-1,0x0083,0x0000,
-1,0x0084,0x0000,
-1,0x0085,0x0000,
//--------------Panel Control-------------------//
-1,0x0090,0x0010,
-1,0x0092,0x0000,
-1,0x0093,0x0003,
-1,0x0095,0x0110,
-1,0x0097,0x0000,
-1,0x0098,0x0000,
-1,0x0007,0x0173,
-3

ILI9341

Watterott MI0283QT-9A uses this, but the driver is broken (See issue).
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

ILI9225

Use init sequence from this FBTFT driver: http://zdoom.ic.cz/raspberry/ili9225fb.c
Video: http://www.youtube.com/watch?v=UZEK9zQeTnM

modprobe flexfb width=176 height=220 regwidth=16 setaddrwin=1 init=

piwik

Clone this wiki locally