Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Udisplay support for rgb displays #17414

Merged
merged 7 commits into from
Dec 18, 2022
Merged

Conversation

gemu2015
Copy link
Contributor

Description:

adds new touch driver gt911
adds support for rgb displays to universal display driver
=> sunton esp32-s3 rgb display 800x480
the cheapest high res esp board available, very good display panel but a little slow
https://www.makerfabs.com/sunton-esp32-s3-4-3-inch-ips-with-touch.html

{"NAME":"SUNTON","GPIO":[1,1,1,1,1,1,1,1,1,1,6720,704,736,672,1,1,1,1,1,640,608,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":1}

remark:
this driver does heavy DMA. obviously there is a clash with RGB PSRAM DMA and
a special heap call:
uint32_t free_block_size = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT);
it generates a divide by zero error when the display is enabled

there seams to be no other anomaly, everything else works without any problems

i had to disable this call by define
#define RGB_DISPLAY
otherwise get info crashes with zero divide error.

Checklist:

  • The pull request is done against the latest development branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR and the code change compiles without warnings
  • The code change is tested and works with Tasmota core ESP8266 V.2.7.4.9
  • The code change is tested and works with Tasmota core ESP32 V.2.0.5
  • I accept the CLA.

NOTE: The code change must pass CI tests. Your PR cannot be merged unless tests pass

@Jason2866
Copy link
Collaborator

Price is really nice. But shipping :-( Do you know a other source?

@gemu2015
Copy link
Contributor Author

Shipping was 15 euros and arrived in 8 days !

@Jason2866
Copy link
Collaborator

Thx. Had to create an account. Well really nice, latest S3 on board and touch is already included too + card reader. @s-hadinger Perfect for LVGL.

@gemu2015
Copy link
Contributor Author

i forgot an info.
this board is 16M_qio_opi

@arendst arendst merged commit 1cdd5c3 into arendst:development Dec 18, 2022
@gemu2015 gemu2015 deleted the udisplay_rgb branch December 18, 2022 14:50
@Jason2866
Copy link
Collaborator

Really nice display ;-) The template should set the A3 GPIO too.

{"NAME":"SUNTON","GPIO":[1,1,1,1,1,1,1,1,1,1,6720,704,736,672,1,1,1,1,1,640,608,1,0,0,0,0,0,6210,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":1}

will upload a autoconfig file...

@Rushmed
Copy link

Rushmed commented Feb 23, 2023

Hi,
sorry if thats not th correct place for question.
I got the ESP32-8048S043 display. I flashed it via:
image
I added this template
an did the autoconf with
image
.

I am able to connect the webinterface but dont get the display to show anything.

Does anybody have an idea what I am doing wrong?

Maybe it has something to do with the template and autoconfig as ESP32-8048S050 has ST7262 and ESP32-8048S043 has ILI9485.

@Jason2866
Copy link
Collaborator

Different display controller, so it needs a different display.ini to init.

@Rushmed
Copy link

Rushmed commented Feb 23, 2023

So I do have to compile it?

@Jason2866
Copy link
Collaborator

You have to read ;-) Start here https://tasmota.github.io/docs/Displays/#universal-display-driver

@Rushmed
Copy link

Rushmed commented Feb 23, 2023

Ok thanks.

@Jason2866
Copy link
Collaborator

Or is it this one #17326

@Rushmed
Copy link

Rushmed commented Feb 23, 2023

No, the display I have is:
ESP32-8048S043 Specifications-EN.pdf

It`s strange I cant find any information for ILI9485.

@Jason2866
Copy link
Collaborator

Jason2866 commented Feb 23, 2023

Strange managed to download the demo package from here http://www.jczn1688.com/zlxz
There is no mention of a ILI9485 anywhere.
Demo code Hello World for the Display


/*******************************************************************************
 ******************************************************************************/
#include <Arduino_GFX_Library.h>

#define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin
#define TFT_BL 2
/* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */
#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *gfx = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */

/* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */
//Arduino_DataBus *bus = create_default_Arduino_DataBus();

/* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */
//Arduino_GFX *gfx = new Arduino_ILI9341(bus, DF_GFX_RST, 0 /* rotation */, false /* IPS */);

Arduino_ESP32RGBPanel *bus = new Arduino_ESP32RGBPanel(
    GFX_NOT_DEFINED /* CS */, GFX_NOT_DEFINED /* SCK */, GFX_NOT_DEFINED /* SDA */,
    40 /* DE */, 41 /* VSYNC */, 39 /* HSYNC */, 42 /* PCLK */,
    45 /* R0 */, 48 /* R1 */, 47 /* R2 */, 21 /* R3 */, 14 /* R4 */,
    5 /* G0 */, 6 /* G1 */, 7 /* G2 */, 15 /* G3 */, 16 /* G4 */, 4 /* G5 */,
    8 /* B0 */, 3 /* B1 */, 46 /* B2 */, 9 /* B3 */, 1 /* B4 */
);
// option 1:
// ST7262 IPS LCD 800x480
 Arduino_RPi_DPI_RGBPanel *gfx = new Arduino_RPi_DPI_RGBPanel(
   bus,
   800 /* width */, 0 /* hsync_polarity */, 8 /* hsync_front_porch */, 4 /* hsync_pulse_width */, 8 /* hsync_back_porch */,
   480 /* height */, 0 /* vsync_polarity */, 8 /* vsync_front_porch */, 4 /* vsync_pulse_width */, 8 /* vsync_back_porch */,
   1 /* pclk_active_neg */, 16000000 /* prefer_speed */, true /* auto_flush */);

#endif /* !defined(DISPLAY_DEV_KIT) */
/*******************************************************************************
 * End of Arduino_GFX setting
 ******************************************************************************/

void setup(void)
{
    gfx->begin();
    gfx->fillScreen(BLACK);

#ifdef TFT_BL
    pinMode(TFT_BL, OUTPUT);
    digitalWrite(TFT_BL, HIGH);
#endif

    gfx->setCursor(10, 10);
    gfx->setTextColor(RED);
    gfx->println("Hello World!");

    delay(5000); // 5 seconds
}

void loop()
{
    gfx->setCursor(random(gfx->width()), random(gfx->height()));
    gfx->setTextColor(random(0xffff), random(0xffff));
    gfx->setTextSize(random(6) /* x scale */, random(6) /* y scale */, random(2) /* pixel_margin */);
    gfx->println("Hello World!");

    delay(1000); // 1 second
}

@Jason2866
Copy link
Collaborator

@gemu2015 Can you help?

@gemu2015
Copy link
Contributor Author

gemu2015 commented Feb 24, 2023

sorry i can't , as long as there is no proven to work source code i am not willing to dig into this.
@Rushmed
you will have to compile a demo package for your display and if it is working well provide a link to the working source code.

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

@gemu2015 So I have to compile the code @Jason2866 sent and upload it to the device?
Any recommendation for test procedure or is the test passed when "Hello World!" is shown?

@gemu2015
Copy link
Contributor Author

yes "hello world" is enough

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

Ok, got it.
I followed this instruction:
Getting started 4.3 Inch.pdf

Now I have display output. Every every second another "Hello World" wit different color and background color is added to the screen.
image

FYI as in the instruction I needed to copy
lv_conf.h.txt
(Changed ending to .txt to be able to upload)
maybe it contains some useful information.

@gemu2015
Copy link
Contributor Author

ok, this seems to be the sunton-s3
apply the template from above (from @Jason2866 ), copy the sunton descriptor (ST7262_rgb16_display.ini)
as display.ini into file system and restart.

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

Ok, thanks for help.
I flashed again.
Applied:
{"NAME":"SUNTON","GPIO":[1,1,1,1,1,1,1,1,1,1,6720,704,736,672,1,1,1,1,1,640,608,1,0,0,0,0,0,6210,1,1,1,1,1,1,1,1,1,1],"FLAG":0,"BASE":1}
and copied
autoexec.be.txt
and
display.ini.txt
to file system.
image
Restarted bu no display output.

@gemu2015
Copy link
Contributor Author

if you took the very first template you have to enable udisplay by setting GPIO 0 to Option A3

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

No, i took the second one.

@gemu2015
Copy link
Contributor Author

your display.ini is complete garbage. it should only be a few lines

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

I used ST7262_rgb16_display.ini fom here and renamed it.

@gemu2015
Copy link
Contributor Author

look at the file size, it should have only have 164 bytes

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

Thanks, ill` check.

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

Now the backlight blinks three times on startup and then stays on and lower brightness. Screen stays black.

@gemu2015
Copy link
Contributor Author

what is in the console during boot ?

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

00:00:00.002-286/14 HDW: ESP32-S3 00:00:00.013-284/13 UFS: FlashFS mounted with 12588 kB free 00:00:00.021 CFG: Loaded from File, Count 26 00:00:00.023 FRC: Some settings have been reset (4) 00:00:00.026 SPI: Hardware using GPIO12(CLK), GPIO11(MOSI) and GPIO13(MISO) 00:00:00.035 TFS: File '.drvset003' not found 00:00:00.035 CFG: Energy use defaults as file system not ready or file not found 00:00:00.654 Project tasmota - Tasmota Version 12.4.0.1(lvgl-haspmota)-2_0_7(2023-02-23T21:39:11) 00:00:01.339 WIF: Connecting to AP1 Slowdazamba Channel 4 BSSId D0:21:F9:B9:64:71 in mode 11n as tasmota-8F70B4-4276... 00:00:02.096 WIF: Connected 00:00:02.349 HTP: Web server active on tasmota-8F70B4-4276 with IP address 192.168.178.219 17:19:48.153 RSL: INFO1 = {"Info1":{"Module":"SUNTON","Version":"12.4.0.1(lvgl-haspmota)","FallbackTopic":"cmnd/DVES_8F70B4_fb/","GroupTopic":"cmnd/tasmotas/"}} 17:19:48.165 RSL: INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"tasmota-8F70B4-4276","IPAddress":"192.168.178.219","IP6Global":"","IP6Local":"fe80::3685:18ff:fe8f:70b4"}} 17:19:48.178 RSL: INFO3 = {"Info3":{"RestartReason":{"Exception":28,"Reason":"LoadProhibited","EPC":"4208494b","EXCVADDR":"0000000c","CallChain":["42084948","4207c557","42075a79","420775e1","4209240b","42077601","420a9ed6","420b705c","42029536"]},"BootCount":8}} 17:19:48.201 RSL: RESULT = {"POWER":"ON"} 17:19:48.202 RSL: POWER = ON 17:19:50.949 QPC: Reset 17:19:51.946 RSL: STATE = {"Time":"2023-02-24T17:19:51","Uptime":"0T00:00:07","UptimeSec":7,"Heap":228,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"POWER":"ON","Wifi":{"AP":1,"SSId":"Slowdazamba","BSSId":"D0:21:F9:B9:64:71","Channel":4,"Mode":"11n","RSSI":100,"Signal":-49,"LinkCount":1,"Downtime":"0T00:00:03"}}

@gemu2015
Copy link
Contributor Author

this caused a reset,
please delete auto exec.be maybe it is also garbage.
if that doesn't not help
probably it isn't exactly this display, despite the backlight matches.

maybe it is the ILI chip variant. to adapt this is much more work

why don't you buy a display known to be supported by tasmota like the one above.

it is only 25 Euros + 15 euros shipping

@Rushmed
Copy link

Rushmed commented Feb 24, 2023

Before buying I checked blakkers page an found ESP32-8048S050. Which I wasnt able to fin a seller.
I thought the difference between ESP32-8048S050 and ESP32-8048S043 is just the screen size.

Thanks anyway.

@Rushmed
Copy link

Rushmed commented Feb 25, 2023

Which display is supported ESP32-8048S050, ESP32-4827S043?

@gemu2015
Copy link
Contributor Author

the one at start of this post with controller ST7262 800x480 pixels
(should be ESP32-8048S050)
see link above makerfabs.

@Rushmed
Copy link

Rushmed commented Feb 25, 2023

The link in the first post is for a 4.3" display. No mention of a 5" screen.

According the these secifications the only display with ST7262 is the 5" one.
ESP32-8048S043 Specifications-EN.pdf
ESP32-4827S043 Specifications-EN.pdf
ESP32-8048S050 Specifications-EN.pdf

@gemu2015
Copy link
Contributor Author

quite confusing.
anyway i ordered the above display and implemented the driver. it is definitely an ST7262 with capacitive touch and it is 4,3 inch

btw i can not recommend resistive touch at all.

@gemu2015
Copy link
Contributor Author

gemu2015 commented Feb 25, 2023

i see the display is out of stock now. it was remarkably cheep. the 5 inch is more expensive. i don't know if its hardware compatible though despite it has the same display controller chip. but having the same chip only GPIO numbers may have to be changed.

@gemu2015
Copy link
Contributor Author

what you can try is to identify your currents display gpio definitions.
they are in hello world.ino like below for 5 inch:

these pins must be transposed into display.ini.
since it is a RGB panel no specific chip opcodes apply.

in the tasmota display docs you will find further explanation how to
setup Display.ini. take the ini file for St7262 as a template and modify the GPIO to fit your device.

Arduino_ESP32RGBPanel bus = new Arduino_ESP32RGBPanel(
GFX_NOT_DEFINED /
CS /, GFX_NOT_DEFINED / SCK /, GFX_NOT_DEFINED / SDA /,
40 /
DE /, 41 / VSYNC /, 39 / HSYNC /, 42 / PCLK /,
45 /
R0 /, 48 / R1 /, 47 / R2 /, 21 / R3 /, 14 / R4 /,
5 /
G0 /, 6 / G1 /, 7 / G2 /, 15 / G3 /, 16 / G4 /, 4 / G5 /,
8 /
B0 /, 3 / B1 /, 46 / B2 /, 9 / B3 /, 1 / B4 */
);
// option 1:
// ST7262 IPS LCD 800x480
Arduino_RPi_DPI_RGBPanel gfx = new Arduino_RPi_DPI_RGBPanel(
bus,
800 /
width /, 0 / hsync_polarity /, 8 / hsync_front_porch /, 4 / hsync_pulse_width /, 8 / hsync_back_porch /,
480 /
height /, 0 / vsync_polarity /, 8 / vsync_front_porch /, 4 / vsync_pulse_width /, 8 / vsync_back_porch /,
1 /
pclk_active_neg /, 16000000 / prefer_speed /, true / auto_flush */);

@Rushmed
Copy link

Rushmed commented Feb 25, 2023

quite confusing. anyway i ordered the above display and implemented the driver. it is definitely an ST7262 with capacitive touch and it is 4,3 inch

btw i can not recommend resistive touch at all.

Thats confusing me even more as there is no 800x480 Sunton display with ESP and resistive touch.

Tried editing the display.ini but for example the first line is:
:H,ST7262,800,480,16,RGB,40,41,39,42,2,15,16,4,45,48,47,21,14,8,3,46,9,1,5,6,7,12
Up to RGB I understand but why there are 22 numbers after RGB.
Following the instruction there have to be 9.
image

@gemu2015
Copy link
Contributor Author

look at point 6: b0-b5 are 6 GPIO pins named b0,b1,b2 etc.

@Rushmed
Copy link

Rushmed commented Feb 27, 2023

I did the transformation with the "hello world" code.
:H,ST7262,800,480,16,RGB,40,41,39,42,BL,8,3,46,9,1,B5,5,6,7,15,16,4,45,48,47,21,14,PixelSpeed
I did not find values for backlight, B5 and pixel clock speed in MHz.

Curious that this does not fit to the wiring diagram in the documentation.
image

@gemu2015
Copy link
Contributor Author

sorry doku error b goes from b0-b4 , try pixel clock 12
you must also match
:V line with hsync_polarity etc.

@Rushmed
Copy link

Rushmed commented Feb 27, 2023

Now my display.ini looks like this:
:H,ST7262,800,480,16,RGB,40,41,39,42,2,8,3,46,9,1,5,6,7,15,16,4,45,48,47,21,14,16 :S,2,1,1,0,40,20 :V,0,8,4,8,0,8,4,8,1 :0,00 :1,01 :2,02 :3,03 :TI1,5d,20,19,-1,38 #
Backlight blinks three times on startup and stays on, no more life sign.

Starting with this .ini I still get no display output but I am able to toggle backlight and displaydimmer comand is working.
:H,ILI9488,480,320,16,PAR,16,-1,37,36,35,48,45,47,21,14,13,12,11,10,9,3,8,16,15,7,6,5,4,20 :S,2,1,1,0,40,20 :I E0,0F,00,03,09,08,16,0A,3F,78,4C,09,0A,08,16,1A,0F E1,0F,00,16,19,03,0F,05,32,45,46,04,0E,0D,35,37,0F C0,2,17,15 C1,1,41 C5,3,00,12,80 36,1,48 3A,1,55 B0,1,80 B1,1,A0 B4,1,02 B6,2,02,02 E9,1,00 F7,4,A9,51,2C,82 11,80 29,0 :o,28 :O,29 :A,2A,2B,2C,16 :R,36 :0,28,00,00,85 :1,88,00,00,02 :2,E8,00,00,84 :3,48,00,00,00 :i,20,21 :TI1,38,*,* :B,20,0 #

@gemu2015
Copy link
Contributor Author

the formatting of display.ini is important too. the line endings MUST be Linefeed not carriage return. (i assume this to be wrong because the formatting of your post above ist strange)

it would help if you enable debugging in universal display driver and monitor the output of serial monitor during startup.
edit file uDisplay.cpp and remove // before this line to enable debug
//#define UDSP_DEBUG
and recompile

@Rushmed
Copy link

Rushmed commented Feb 27, 2023

Compiled a tasmota32-lvgl.bin after installation no lifesign. No ap, no webinterface.
Do Ihave to compile tasmota32-lvgl.bin or something else to run on this S3?

Do I have to add something else to user config?

@MiggyMan
Copy link

@Rushmed did you ever get this working with the ILI9485/ESP32-8048S043 ?

@Rushmed
Copy link

Rushmed commented Nov 16, 2023

Not really.

@MiggyMan
Copy link

I thought you might say that, i was kind of hoping to use the haspmota functionality in tasmota with one of these to replace openhasp since it has no support for deep sleep (making a remote :D)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants