Arduino Forum

Using Arduino => Displays => Topic started by: bodmer on Mar 01, 2018, 06:30 pm

Title: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 01, 2018, 06:30 pm
The ESP32 boards available have sufficient pins to drive 8 bit parallel based TFT displays.

Edit: The TFT_eSPar repository has been deleted. The TFT_eSPI library here (https://github.com/Bodmer/TFT_eSPI) has now been updated and incorporates the parallel display support.

The User_Setup.h file, as written, supports an UNO style ESP32 and ILI9481 480x320 8 bit parallel display.

The ESP32 board I have been using for testing has the following pinout:

(https://i.imgur.com/bvM6leE.jpg)

UNO style boards with a Wemos R32(ESP32) label are also available at low cost with the same pin-out.

Unfortunately the typical UNO/mcufriend TFT display board maps LCD_RD, LCD_CS and LCD_RST signals to the ESP32 pins 35, 34 and 36 which are input only.  To solve this I linked in the 3 spare pins IO15, IO33 and IO32 by adding wires to the bottom of the board as follows:

IO15 wired to IO35
IO33 wired to IO34
IO32 wired to IO36

Performance is quite good, the Adafruit graphics test completes in ~2s and the UTFT test in ~0.8s, the screen clears in ~40ms.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 01, 2018, 06:40 pm
Here is a graphic of the modification in the above post to make those LCD control pins output.

(https://i.imgur.com/pUZn6lF.jpg)
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: david_prentice on Mar 01, 2018, 06:49 pm
Ah-ha.    You have used the same hardware mod as I use.

It will be good to try some of your extra text drawing methods.     MCUFRIEND_kbv only provides the regular Adafruit_GFX methods.

Regarding Adafruit Tests.  I can achieve 0.8 seconds for a 240x320 display when I use an overclocked Xmega.     But this is pretty much the limit for most TFT controllers.
2 seconds on a 320x480 is very good result.

Parallel displays are quite common (and cheap).   SPI displays always seem a better use of resources.
Unfortunately very few SPI modules are available on Ebay / AliExpress.    Mostly 240x320 ILI9341.

David.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 05, 2018, 10:21 pm
Hi David,

I've merged the 8 bit parallel support into my local copy the TFT_eSPI library for testing prior to updating Github. I have experimented further, added 8 bit parallel code to read the TFT and that is working well.

graphicstest indeed reports 0.79s with an ILI9341 display, this is limited by the ESP GPIO bit update period because the ESP32 can only change pin state every ~50ns when bit bashing.

Bodmer
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: david_prentice on Mar 05, 2018, 10:41 pm
It is fairly academic when you get to those speeds.    Does anyone care if you do Adafruit Tests in 0.5s or 0.8s ?
Running a Uno shield on a Mega2560 has to mangle the data bus on random GPIO pins.   The same Adafruit Tests take 18 seconds or so.    The ESP32 has to do similar mangling but achieves it much quicker.

It would be so much nicer to run proper SPI displays on the ESP32 (or ESP8266)
The RPi shift register kludge of a parallel display is unpleasant.

I have not got around to playing with anti-aliasing grayscales yet.    I need to summon some enthusiasm.

David.

Edit.   I knew that I had a question for you.    Do you have an HX8357-A datasheet?  or an HX8357-C datasheet newer than April 2011?
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 06, 2018, 01:21 am
Agreed, the speed does become acedemic and the law of diminishing returns apply.  I do want to get sprites running fast though for my projects so during the update I couldn't resist streamlining the rendering!

The TFT read seems quite fast too (~1Mpixel/s) and makes smooth software scrolls possible. I have made a sliding block puzzle example for fun that slides small image blocks smoothly but I have not tried to get the resistance based touch screen working yet.

I am not a fan of the RPi serial TFT designs but serial 480x320 screens are scarce and tend to be costly, hence the move to the UNO style ILI9481 for the ESP32.

As pointed out UNO displays are readily available and cheap.

Edit: P.S I only have old copies of the data sheets straight off the web ;-(

I have just updated the TFT_eSPar test library with all the sprite and smooth font code, essentially this is a test copy of the new TFT_eSPI library.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: Phaedra on Mar 06, 2018, 06:41 pm
Working well on an ILI9488 here. Excellent job.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 07, 2018, 10:53 pm
@Phaedra

Thanks for the feedback.  Did you add another driver for the ILI9488 or use the existing ILI9481 driver?

I ask because normally a slightly different set of initialisation commands are needed for the ILI9488 TFT.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: Phaedra on Mar 08, 2018, 12:16 am
I created a new set of init, rotation & definition files specifically for the ili9488 and added references to them.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 11, 2018, 12:38 am
I have added the ILI9488 support and modified the TFT read functions to support that board.

The Adafruit HX8357D board has been added to the supported drivers but I do not have one of those boards so am unable to test... report back if you have tried that display in SPI mode with the TFT_eSPI library.

I have modified the original post as the experimental repository has now been deleted. The parallel support has been added into the TFT_eSPI master library which now supports both Serial and Parallel Interface displays.  The parallel displays must be 8 bits and the ESP32 must be used.

The library still supports SPI displays on both the ESP8266 and ESP32!
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: Phaedra on Mar 11, 2018, 01:17 pm
I didn't find:

User_Setups/Setup13_ILI9481_Parallel.h
User_Setups/Setup14_ILI9341_Parallel.h
User_Setups/Setup15_HX8357D.h       
User_Setups/Setup16_ILI9488_Parallel.h

on GitHub in the latest TFT_eSPI release. It's possibly me being stupid.

Is it possible also release a HX8357D parallel user setup as well and I will test that?
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 11, 2018, 03:10 pm
@Phaedra

Nope. it's me being stupid for missing them out!

I have updated Github, thanks.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Mar 13, 2018, 03:08 am
Is it possible also release a HX8357D parallel user setup as well and I will test that?
Any of the existing drivers can be used with a parallel interface display board.  Just edit the driver (https://github.com/Bodmer/TFT_eSPI/blob/master/User_Setups/Setup16_ILI9488_Parallel.h#L21) to for example to:

#define HX8357D_DRIVER

Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: ciko2k on Apr 13, 2018, 05:25 pm
Hi bodmer. compliment for your library i used it with esp32 and works very well with spi 2.4 ili9341 tft lcd.
now i want to use this library with an other 2.4" ili9341 tft lcd with 8 bit parallel interface,  and esp32.


in User_Setup.h  i uncomment only:

#define ILI9341_DRIVER
..
#define ESP32_PARALLEL.

the rest is commented.


in User_Setup_Select.h i uncomment only :

#include <User_Setup.h>

#include <User_Setups/Setup14_ILI9341_Parallel.h> 



i had connected the esp32 to the lcd like this:

//#define TFT_CS   33 
//#define TFT_DC   15
//#define TFT_RST  32 

//#define TFT_WR    4 
//#define TFT_RD    2 

//#define TFT_D0   12 
//#define TFT_D1   13 
//#define TFT_D2   26 
//#define TFT_D3   25 
//#define TFT_D4   17
//#define TFT_D5   16
//#define TFT_D6   27
//#define TFT_D7   14

but the display doesn't Work... where i'm wrong?

thanks for your work and your time..
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Apr 21, 2018, 08:23 pm
in User_Setup_Select.h only one setup should be called up, comment out this one:

//#include <User_Setup.h>


The pins are defined for you in the "Setup14_ILI9341_Parallel.h" file.

You do not need to edit that file if you use the same pins, which you have.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: ciko2k on Apr 23, 2018, 10:18 pm
Hi,
thanks for your answer and your work here..

i don't know why, but my system doesn't work with this library. with graphictest_kbv from MCUFRIEND_kbv library works great.
i have a WROOM32 connected to the display by 15cm jump wire. i don't know if that are too long, but if with graphictest_kbv works, i don't thik thi is the issue..


David suggest me to buy a TTGO, but it is sold only in China and it arrive here after 30-40 days.. too long time.

i'll do a PCB with this connection in the week end, i hope, and i'll test it another time..

thanks for all..
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: david_prentice on Apr 23, 2018, 10:39 pm
What country are you in?

I bought my TTGO board from the UK.  It probably took 2 days.   Yes,  it would have been cheaper from China but it is a long wait!

I am guessing that you are in Central Europe.

Seriously,   you need good reliable connections e.g. from a shield.
Flying wires (especially if not soldered) are pretty suspicious.

David.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: ciko2k on Apr 25, 2018, 11:49 am
I'm from Italy..
yesterday i welded short wires between WROOM32  and my 2.4lcd.

with graphictest_kbv works, but not with TFT_eSPI examples.

this is the report of the Read_User_Setup.ino

Quote
Code: [Select]

Processor    = ESP32
Frequency    = 240 MHz
Transactions = Yes
Interface    = Parallel
Display driver = 9341
Display width  = 240
Display height = 320

TFT_CS   = D33 (GPIO 33)
TFT_DC   = D15 (GPIO 15)
TFT_RST  = D32 (GPIO 32)

TFT_WR   = D4 (GPIO 4)
TFT_RD   = D2 (GPIO 2)

TFT_D0   = D12 (GPIO 12)
TFT_D1   = D13 (GPIO 13)
TFT_D2   = D26 (GPIO 26)
TFT_D3   = D25 (GPIO 25)
TFT_D4   = D17 (GPIO 17)
TFT_D5   = D16 (GPIO 16)
TFT_D6   = D27 (GPIO 27)
TFT_D7   = D14 (GPIO 14)

Font GLCD   loaded
Font 2      loaded
Font 4      loaded
Font 6      loaded
Font 7      loaded
Font 8      loaded
Smooth font enabled



i attached 2 configuration file.. if could be useful.. thanks and have a nice day..
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: bodmer on Apr 25, 2018, 11:09 pm
@ciko2k

The settings you posted using the "Read_User_Setup" sketch look fine. I can only assume that the display is not an ILI9341. David's library determines the correct driver by reading the display so maybe it woks because is it automatically selecting a different driver.

I do not have any other suggestions to help :-(, the 4 screens I tested all work fine with the settings you have used.
Title: Re: Experimental library for ESP32 and 8 bit parallel displays, e.g. mcufriend style
Post by: david_prentice on Apr 25, 2018, 11:44 pm
His controller is a "0x9302" of unknown manufacture.   It starts by itself.
It may or may not be upset by a genuine ILI9341 initialisation.

I have never seen a 0x9302.   So I can't test it.

Life gets fairly complicated when you have to support multiple controllers.   Especially ones without any datasheet.

I would suggest that a regular SPI 3.3V ILI9341 display is used.   It will work with any 3.3V MCU without wasting pins.    It works nicely with ESP8266.

David.