notro / fbtft

Linux Framebuffer drivers for small TFT LCD display modules. Development has moved to https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fbtft?h=staging-testing
1.85k stars 493 forks source link

ILI9488 4 Wire SPI display interface driver is not working #511

Closed awetechnique closed 3 years ago

awetechnique commented 6 years ago

Hello,

I am currently working on power up TianMa TM035NDH07 (ili9488 driver) display thru the Raspberry Pi CM3 hardware. The hardware itself should not have issue since i have use the same hardware to power on the Adafruit display (https://www.adafruit.com/product/2423 ) successfully. I take from the website, https://github.com/notro/fbtft/issues/490, as reference to create the ili9488 driver. The hardware connection is using: 4-lines SPI and the display data is driving thru the SPI interface as well. i have checked the initialization waveform and i do not think there is any issue there (please see the waveform signal below). For the reset signal, i connect to permanent pull high.

ili9488_init_waveform

After all the above test, the display still cannot display any image.

The ili9488 driver:

------------------------------------START OF ILI9488 DRIVER---------------------------------------

/*

define DEBUG 1

define VERBOSE_DEBUG 1

include <linux/module.h>

include <linux/kernel.h>

include <linux/init.h>

include <linux/delay.h>

include <linux/gpio.h>

include "fbtft.h"

define DRVNAME "fb_ili9488"

define WIDTH 272

define HEIGHT 480

// use the customer init code. static int init_display(struct fbtft_par *par) { int ret = 0;

//unsigned displayid;
//displayid = read_displayid(par);
//fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "ili9488 Display ID: 0x%04X\n", displayid);

fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", __func__);

par->fbtftops.reset(par);

//ret = gpio_request(3, "ili9488_ertft035");
ret = gpio_request(3, "fb_ili9488");
pr_err("Titus: %s:%d ret %d\n", __func__, __LINE__, ret);
//ret = gpio_request(4, "ili9488_ertft035");
ret = gpio_request(4, "fb_ili9488");
pr_err("Titus: %s:%d ret %d\n", __func__, __LINE__, ret);
//ret = gpio_request(5, "ili9488_ertft035");
ret = gpio_request(5, "fb_ili9488");
pr_err("Titus: %s:%d ret %d\n", __func__, __LINE__, ret);

//IM0, IM1, IM2 are pulled high for 4wire SPI interface.
gpio_set_value(3, 1);
gpio_set_value(4, 1);
gpio_set_value(5, 1);

//for debugging //write_reg(par, 0x04); / display id / / startup sequence for ER-TFT035-6 / write_reg(par, 0x01); / software reset /

gpio_set_value(par->gpio.reset, 1);
mdelay(5);
gpio_set_value(par->gpio.reset, 0);
mdelay(20);
gpio_set_value(par->gpio.reset, 1);
mdelay(150);

pr_err("************* Titus: LCD reset is done! par->gpio.reset %d ************\n", par->gpio.reset);

//write_reg(par, 0x04); //read display identification information for troubleshooting //unsigned displayid; //displayid = read_displayid(par); //fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "ili9488 Display ID: 0x%04X\n", displayid);

write_reg(par, 0xF7, 0xA9, 0x51, 0x2C, 0x82); write_reg(par, 0xE9, 0x00); write_reg(par, 0x36, 0x48); write_reg(par, 0x3A, 0x66);//gate control

//power setting write_reg(par, 0xC0, 0x1C, 0x1C); write_reg(par, 0xC1, 0x41);//VGH/VGL control write_reg(par, 0xC2, 0x33); write_reg(par, 0xC5, 0x00, 0x50, 0x80); //VCOM write_reg(par, 0xB0, 0x8A); write_reg(par, 0xB1, 0xB0); write_reg(par, 0xB4, 0x02); //write_reg(par, 0xB6, 0x22, 0x02, 0x3B); //modified by kschin@20180313. write_reg(par, 0xB6, 0x02, 0x02, 0x3B);

//gamma cluster setting write_reg(par, 0xE0, 0x00, 0x04, 0x09, 0x06, 0x16, 0x0C, 0x3D, 0xC7, 0x4D, 0x09, 0x10, 0x0C, 0x1D, 0x21, 0x0F); write_reg(par, 0xE1, 0x00, 0x1E, 0X22, 0x03, 0x0F, 0x06, 0x32, 0x38, 0x42, 0x03, 0x09, 0x09, 0x34, 0x39, 0x0F); write_reg(par, 0x2A, 0x00, 0x18, 0x01, 0x27); write_reg(par, 0x2B, 0x00, 0x00, 0x01, 0xDF);

write_reg(par, 0x11); //sleep out mdelay(120); write_reg(par, 0x29); //display on mdelay(50);

pr_err("************* Titus: LCD driver is initialized! ************\n");

return 0;

}

static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) { fbtft_par_dbg(DEBUG_SET_ADDR_WIN, par, "%s(xs=%d, ys=%d, xe=%d, ye=%d)\n", func, xs, ys, xe, ye);

/* column address */
write_reg(par, 0x2a, xs >> 8, xs & 0xff, xe >> 8, xe & 0xff);

/* Row address */
write_reg(par, 0x2b, ys >> 8, ys & 0xff, ye >> 8, ye & 0xff);

/* memory write */
write_reg(par, 0x2c);

}

define HFLIP 0x01

define VFLIP 0x02

define ROWxCOL 0x20

static int set_var(struct fbtft_par *par) { fbtft_par_dbg(DEBUG_INIT_DISPLAY, par, "%s()\n", func);

switch (par->info->var.rotate) {
case 270:
    write_reg(par, 0x36, ROWxCOL | HFLIP | VFLIP | (par->bgr << 3));
    break;
case 180:
    write_reg(par, 0x36, VFLIP | (par->bgr << 3));
    break;
case 90:
    write_reg(par, 0x36, ROWxCOL | (par->bgr << 3));
    break;
default:
    write_reg(par, 0x36, HFLIP | (par->bgr << 3));
    break;
}
return 0;

}

static struct fbtft_display display = { .regwidth = 8, .width = WIDTH, .height = HEIGHT, .fbtftops = { .set_addr_win = set_addr_win, .set_var = set_var, .init_display = init_display, }, };

//FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9488_ertft035", &display); FBTFT_REGISTER_DRIVER(DRVNAME, "ilitek,ili9488", &display);

MODULE_ALIAS("spi:" DRVNAME); MODULE_ALIAS("platform:" DRVNAME); MODULE_ALIAS("spi:ili9488"); MODULE_ALIAS("platform:ili9488");

MODULE_DESCRIPTION("FB driver for the ILI9488 LCD Controller"); MODULE_AUTHOR("Titus Rathinaraj Stalin"); MODULE_LICENSE("GPL");

------------------------------------END OF ILI9488 DRIVER---------------------------------------

I am running out of method for the troubleshooting, if anyone has any ideas, please help to advise.

Thanks!

awetechnique commented 6 years ago

LCD module and driver datasheet Final specification TM035NDH07-00 V2 1.pdf ILI9488 Data Sheet_100.pdf

awetechnique commented 6 years ago

Hi All,

The issue is solved, some connection issue is found. But i see another problem now.

display_shifting

How do i adjust the display so that the top portion will not be covered and the bottom portion can be display?

Thanks!

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.