Need sample code for ILI9488 LCD on SPI Interface

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby loboris » Sun Sep 03, 2017 11:22 am

There are two sets of pin configuration in tftspi.h, one for ESP_WROVER_KIT and one for other boards, you should modify the pins defines in the second set (starting with #define PIN_NUM_MISO 19 // SPI MISO)

Code: Select all

#ifdef CONFIG_EXAMPLE_ESP_WROVER_KIT

#define DISP_COLOR_BITS_24	0x66
#define TFT_INVERT_ROTATION 0
#define TFT_INVERT_ROTATION1 1
#define TFT_RGB_BGR 0x00

#define PIN_NUM_MISO 25		// SPI MISO
#define PIN_NUM_MOSI 23		// SPI MOSI
#define PIN_NUM_CLK  19		// SPI CLOCK pin
#define PIN_NUM_CS   22		// Display CS pin
#define PIN_NUM_DC   21		// Display command/data pin
#define PIN_NUM_TCS   0		// Touch screen CS pin
#define PIN_NUM_RST 18  	// GPIO used for RESET control
#define PIN_NUM_BCKL 5      // GPIO used for backlight control
#define PIN_BCKL_ON 0       // GPIO value for backlight ON
#define PIN_BCKL_OFF 1      // GPIO value for backlight OFF

#define USE_TOUCH	0

#define DEFAULT_TFT_DISPLAY_WIDTH  240
#define DEFAULT_TFT_DISPLAY_HEIGHT 320
#define DEFAULT_GAMMA_CURVE 0
#define DEFAULT_SPI_CLOCK   26000000
#define DEFAULT_DISP_TYPE   DISP_TYPE_ST7789V

#else

#define DISP_COLOR_BITS_24	0x66
//#define DISP_COLOR_BITS_16	0x55

// #############################################
// ### Set to 1 for some displays,           ###
//     for example the one on ESP-WROWER-KIT ###
// #############################################
#define TFT_INVERT_ROTATION 0
#define TFT_INVERT_ROTATION1 0

// ################################################
// ### SET TO 0X00 FOR DISPLAYS WITH RGB MATRIX ###
// ### SET TO 0X08 FOR DISPLAYS WITH BGR MATRIX ###
// ### For ESP-WROWER-KIT set to 0x00           ###
// ################################################
#define TFT_RGB_BGR 0x08

// ##############################################################
// ### Define ESP32 SPI pins to which the display is attached ###
// ##############################################################

#define PIN_NUM_MISO 19		// SPI MISO
#define PIN_NUM_MOSI 23		// SPI MOSI
#define PIN_NUM_CLK  18		// SPI CLOCK pin
#define PIN_NUM_CS   5		// Display CS pin
#define PIN_NUM_DC   26		// Display command/data pin
#define PIN_NUM_TCS  25		// Touch screen CS pin
I have tested this library on 4 different boards with 3 different displays and never had a problem.
Yes, you can try to change #define SPI_BUS VSPI_HOST to #define SPI_BUS HSPI_HOST
Can you give more details what exactly hapens when you try to run the example?

sukeshak
Posts: 50
Joined: Sat Aug 19, 2017 10:20 am
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby sukeshak » Tue Sep 05, 2017 7:16 pm

When I run the sample, as per serial output everything works... but nothing shows up on the display.
Here is the serial output. The Error happens after some delay... not sure if that's connected.

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371 
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:5408
ho 0 tail 12 room 4
load:0x40078000,len:0
load:0x40078000,len:12040
entry 0x40078f30
[0;32mI (47) boot: ESP-IDF v3.0-dev-265-g969f1bb9-dirty 2nd stage bootloader[0m
[0;32mI (48) boot: compile time 17:08:18[0m
[0;32mI (51) boot: Enabling RNG early entropy source...[0m
[0;32mI (67) boot: SPI Speed      : 40MHz[0m
[0;32mI (80) boot: SPI Mode       : DIO[0m
[0;32mI (92) boot: SPI Flash Size : 4MB[0m
[0;32mI (105) boot: Partition Table:[0m
[0;32mI (116) boot: ## Label            Usage          Type ST Offset   Length[0m
[0;32mI (139) boot:  0 nvs              WiFi data        01 02 00009000 00006000[0m
[0;32mI (162) boot:  1 phy_init         RF data          01 01 0000f000 00001000[0m
[0;32mI (185) boot:  2 factory          factory app      00 00 00010000 00100000[0m
[0;32mI (208) boot:  3 storage          Unknown data     01 82 00180000 00100000[0m
[0;32mI (232) boot: End of partition table[0m
[0;32mI (245) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x0dfa8 ( 57256) map[0m
[0;32mI (334) esp_image: segment 1: paddr=0x0001dfd0 vaddr=0x3ffb0000 size=0x02040 (  8256) load[0m
[0;32mI (344) esp_image: segment 2: paddr=0x00020018 vaddr=0x400d0018 size=0x357ac (219052) map[0m
[0;32mI (587) esp_image: segment 3: paddr=0x000557cc vaddr=0x3ffb2040 size=0x038e0 ( 14560) load[0m
[0;32mI (606) esp_image: segment 4: paddr=0x000590b4 vaddr=0x40080000 size=0x00400 (  1024) load[0m
[0;32mI (609) esp_image: segment 5: paddr=0x000594bc vaddr=0x40080400 size=0x14d24 ( 85284) load[0m
[0;32mI (744) esp_image: segment 6: paddr=0x0006e1e8 vaddr=0x400c0000 size=0x00000 (     0) load[0m
[0;32mI (785) boot: Loaded app from partition at offset 0x10000[0m
[0;32mI (785) boot: Disabling RNG early entropy source...[0m
[0;32mI (786) cpu_start: Pro cpu up.[0m
[0;32mI (797) cpu_start: Starting app cpu, entry point is 0x40080fcc[0m
[0;32mI (0) cpu_start: App cpu up.[0m
[0;32mI (830) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (851) heap_init: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM[0m
[0;32mI (869) heap_init: At 3FFB93B0 len 00026C50 (155 KiB): DRAM[0m
[0;32mI (888) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (908) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (928) heap_init: At 40095124 len 0000AEDC (43 KiB): IRAM[0m
[0;32mI (947) cpu_start: Pro cpu start user code[0m
[0;32mI (1008) cpu_start: Starting scheduler on PRO CPU.[0m
[0;32mI (195) cpu_start: Starting scheduler on APP CPU.[0m

==============================
TFT display DEMO, LoBo 07/2017
==============================

SPI: display device added to spi bus (2)
SPI: attached display device, speed=8000000
SPI: bus uses native pins: false
SPI: display init...
OK

SPI: Changed speed to 40000000

---------------------
Graphics demo started
---------------------
[0;32mI (1484) [SPIFFS]: Registering SPIFFS file system[0m
[0;32mI (1485) [SPIFFS]: Mounting SPIFFS files system[0m
[0;32mI (1485) [SPIFFS]: Start address: 0x180000; Size 1024 KB[0m
[0;32mI (1490) [SPIFFS]:   Work buffer: 2048 B[0m
[0;32mI (1495) [SPIFFS]:    FDS buffer: 384 B[0m
[0;32mI (1499) [SPIFFS]:    Cache size: 2048 B[0m
[0;32mI (1548) [SPIFFS]: Mounted[0m

==========================================
Display: ILI9341: PORTRAIT 240,320 Color
     Clear screen time: 40 ms
Send color buffer time: 156 us (240 pixels)

// This error happens after some delay though
Guru Meditation Error of type LoadProhibited occurred on core  0. Exception was unhandled.
Register dump:
PC      : 0x40002020  PS      : 0x00060c30  A0      : 0x800020b8  A1      : 0x3ffbb150  
A2      : 0x3ffaf720  A3      : 0x800fc7ce  A4      : 0x3ff96458  A5      : 0x00000008  
A6      : 0x0000000d  A7      : 0x00000008  A8      : 0x8000be99  A9      : 0x3ffbb130  
A10     : 0x3ffaf720  A11     : 0x40084a70  A12     : 0x3ffbb1c4  A13     : 0x3ffaf578  
A14     : 0x00000068  A15     : 0x00000006  SAR     : 0x0000001c  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x800fc7da  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000  

Backtrace: 0x40002020:0x3ffbb150 0x400020b5:0x3ffbb170 0x400fe415:0x3ffbb190 0x400e6009:0x3ffbb2a0 0x400e62fc:0x3ffbb2c0 0x400e650c:0x3ffbb2e0 0x400d1133:0x3ffbb340

CPU halted.
Just to confirm, yes I have set the PINs correctly and not in 'CONFIG_EXAMPLE_ESP_WROVER_KIT' section.

If I change SPI BUS the serial shows 1 instead of 2. But still nothing on the display.

Code: Select all

// ==================================================
// Define which spi bus to use VSPI_HOST or HSPI_HOST
#define SPI_BUS HSPI_HOST //VSPI_HOST
// ==================================================

SPI: display device added to spi bus (1)

ESP_Sprite
Posts: 9769
Joined: Thu Nov 26, 2015 4:08 am

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby ESP_Sprite » Wed Sep 06, 2017 1:27 am

It's a known bug. A few days ago, we added a bit of code that disables unused peripherals. Unfortunately, this broke SPI... We have a patch that fixes this in our internal master, but it doesn't seem to have propagated to Github yet. You can wait until it has, or temporarily revert esp-idf to commit 1a9b02ccbce625c057638d573c2665b26de1fede; both of them should make the example work again.

sukeshak
Posts: 50
Joined: Sat Aug 19, 2017 10:20 am
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby sukeshak » Wed Sep 06, 2017 5:37 pm

It's a known bug. A few days ago, we added a bit of code that disables unused peripherals. Unfortunately, this broke SPI... We have a patch that fixes this in our internal master, but it doesn't seem to have propagated to Github yet. You can wait until it has, or temporarily revert esp-idf to commit 1a9b02ccbce625c057638d573c2665b26de1fede; both of them should make the example work again.
Thank you. Any timeline for the GitHub update for the fixes?
Meanwhile I can continue working on other portions of the projects knowing that it will work again without me making any code changes.

sukeshak
Posts: 50
Joined: Sat Aug 19, 2017 10:20 am
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby sukeshak » Sat Sep 09, 2017 9:45 pm

ESP_Sprite wrote:It's a known bug. A few days ago, we added a bit of code that disables unused peripherals. Unfortunately, this broke SPI... We have a patch that fixes this in our internal master, but it doesn't seem to have propagated to Github yet. You can wait until it has, or temporarily revert esp-idf to commit 1a9b02ccbce625c057638d573c2665b26de1fede; both of them should make the example work again.
Still no luck in making the display work. Tried all other branches too without luck :?

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby loboris » Sun Sep 10, 2017 8:30 am

sukeshak wrote:When I run the sample, as per serial output everything works... but nothing shows up on the display.
Have you correctly connected the backlight controll ? If used, the pin and polarity of the on/off has to be set correctly. If not, you have to connect it directly to 3.3V or 5V.
Is there the reset pin on your display? You have to pull it high or connect it to some pin and configure it correctly.

sukeshak
Posts: 50
Joined: Sat Aug 19, 2017 10:20 am
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby sukeshak » Tue Sep 12, 2017 10:29 pm

So here are few points to let you know.

1. With the same PIN settings its working with Arduino Adafruit library
2. I just tried espressif SPI sample (ESP-IDF) and its also working
(I am not sure what its supposed to show, but some designs on the display shows up at least)
https://github.com/espressif/esp-idf/bl ... ple_main.c

Not too sure how to troubleshoot further with your library.

By the way, what does this mean with value of 'false', since I think I am using native SPI pins.
SPI: bus uses native pins: false

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby Ritesh » Tue Jul 16, 2019 8:27 am

Hello loboris,

We have one ILI9163C LCD in which I want to use your example directly. I have checked that your example is not providing support for that.

So, Would you please check from your side and include support for that LCD into your Library with Example?

Below are full details about LCD.
Microtech-Lcd LCD Type:1.77 TFT LCD
Display color:262K
LCD Duty:1/160
Viewing Direction:12:00 O Clock
Active Area(W H):28.032X35.04 mm
Number of Dots:128(R-G-B) 160 mm
Controller:ILI9163C
VDD:2.7~3.3V
Data Transfer:8bitsparallel
3-pin/4-pin serial interface
Display Type:Transmissive type
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby Ritesh » Tue Jul 16, 2019 5:27 pm

Hello Loboris,

Any update for ILI9163C TFT LCD as per requirements?
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: Need sample code for ILI9488 LCD on SPI Interface

Postby Ritesh » Wed Jul 17, 2019 8:56 am

Hello Loboris,

Any update for ILI9163C TFT LCD as per requirements?
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: REEASD, snutw_ and 146 guests