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

Scrambled display on ESP32-2432S028 #544

Open
rodavrow opened this issue Sep 15, 2023 · 17 comments
Open

Scrambled display on ESP32-2432S028 #544

rodavrow opened this issue Sep 15, 2023 · 17 comments
Assignees
Labels
done The underlying issue has been fixed hardware New hardware or driver
Milestone

Comments

@rodavrow
Copy link

rodavrow commented Sep 15, 2023

Perform all steps below and tick them with [x]

  • [x ] Check the related part of the Documentation
  • [x ] Update openHASP to the latest version
  • [x ] Reproduce the issue and describe all steps

Describe the bug

I flashed the ESP32-2432S028 using the web tool with esp32-2432s028r_full_4MB_v0.7.0-rc6_2f4092b.bin - issue is as seen with the screen being misaligned, mirrored and unresponsive to touch.

I then flashed using the latest Github actions nightly to esp32-2432s028r_full_4MB_v0.7.0-rc8_f28627c.bin - issue is the same.

Console operates as expected.

The sample code that the device was originally running operated as expected, both display and touchscreen functioned normally. So the device does not appear to be faulty.

To Reproduce

Flash the ESP32-2432S028 Sunton board with any version of the firmware.

Expected behavior

The screen should display and operate normally.

Screenshots or video

20230915_105711
20230915_105654

@rodavrow rodavrow added the bug Something isn't working label Sep 15, 2023
@rodavrow
Copy link
Author

OK, I may have found the issue. I tried loading ESP-Home using some example code for this board, and I believe this new revision with the USB-C Controller may have a different display controller.

It appears it used to be ILI9341 based on the code I used, but when I loaded the firmware I had exactly the same display issue. I then changed the configration in ESP-Home to ILI9342 it now works as expected.

I will attempt to see what I need to change in openHASP and test.

@rodavrow
Copy link
Author

I'm a bit lost on how to implement the ILI9342 driver, can anyone assist please?

@FreezyExp
Copy link

just set width as height and rotate the screen see
#550 (comment)

@rodavrow
Copy link
Author

Thanks! I felt that the colors were wrong though. Not sure if relevant to this as referenced here:

https://forum.arduino.cc/t/i-have-problems-to-use-my-tft-screen-2-4-ili9342-help-me-please/455398

I tryed a lot of libraries for ILI9341, none works, except maybe one.

I say maybe because :

colors are inverted, black is 0xFFFF and wite 0X0000 , rgb565.
texte is miroired and biggining from right side
portrait screen is displayed and splited in lanscape screen or lanscape screen is diplayed and splited in portrait screen

@yeyeto2788
Copy link

The colors are also inverted, BGR instead of RGB I faced the same issue yesterday trying to adapt the board and make it work.

witnessmenow/ESP32-Cheap-Yellow-Display#40

@Grey-Lancaster
Copy link

+1
needs to be a dropdown on the web install page for the ili9342 as ili9341 does not work

@yeyeto2788
Copy link

Hey @Grey-Lancaster I got it to work with the following code. You still need to configure screen rotation and mirroring through WiFi AP.

Here you have the binary compile in case you're interested.
esp32-2432s028r_full_4MB_v0.7.0-rc9_c200edf.bin.zip

I had to modify a configuration file in order to get it working user_setups/esp32/esp32-2832s028.ini

;***************************************************;
;       Sunton ESP32-WROOM custom dev board with    ;
;               - ILI9341 TFT SPI 4-WIRE            ;
;               - XPT2046 touch controller          ;
;***************************************************;

[esp32-2432s028r]
extends = arduino_esp32_v2
board = esp32dev
monitor_port = COM4       ; Change to the correct port
upload_port = COM4
upload_protocol = esptool
upload_flags =
    --erase-all

build_flags =
    ${arduino_esp32_v2.build_flags}
    ${esp32.no_ps_ram}

;region -- TFT_eSPI build options ------------------------
    ; -D USER_SETUP_LOADED=1
    -D LGFX_USE_V1=1
    -D ILI9342_DRIVER=1
    -D INVERT_COLORS=1
    -D TFT_ROTATION=0 ; 0=0, 1=90, 2=180 or 3=270 degree
    -D TFT_WIDTH=320
    -D TFT_HEIGHT=240
    -D TFT_RST=-1
    -D TFT_SCLK=14
    -D TFT_DC=2
    -D TFT_CS=15
    -D TFT_MOSI=13
    -D TFT_MISO=12
    -D TFT_BCKL=21
    -D SUPPORT_TRANSACTIONS
    -D SPI_FREQUENCY=55000000
    -D SPI_READ_FREQUENCY=20000000
    -D TOUCH_OFFSET_ROTATION=0  ; 1=swap xy, 2=invert x, 4=inverty

    -D ESP32_2432S028R=1
;endregion

; -- Debugging options -----------------------------
;   -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

lib_deps =
    ${arduino_esp32_v2.lib_deps}
    ${lovyangfx.lib_deps}


[env:esp32-2432s028r_4MB]
extends = esp32-2432s028r, flash_4mb
build_flags =
    ${esp32-2432s028r.build_flags}
    -D TOUCH_DRIVER=0x2046 ; XPT2606 Resistive touch panel driver
    -D HASP_USE_LGFX_TOUCH=1
    -D TOUCH_CS=33
    -D TOUCH_SCLK=25
    -D TOUCH_MOSI=32
    -D TOUCH_MISO=39
    -D TOUCH_SDA=-1
    -D TOUCH_SCL=-1
    -D TOUCH_IRQ=36
    -D SPI_TOUCH_FREQUENCY=2500000

; -- Debugging options -----------------------------
;   -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE

lib_deps =
    ${esp32-2432s028r.lib_deps}
    ;${tft_espi.lib_deps}
    ${lovyangfx.lib_deps}
    ;${goodix.lib_deps}

@Grey-Lancaster
Copy link

No clue, colors are terrible and touch is not working. And for some reason HA is not discovering it. Added the plate to yaml, uploaded pages.jason. Info says connected to mqtt

@yeyeto2788
Copy link

For the touch, you need to calibrate it. In regards to HA no clue, haven't actually connected it to HA

@oklona
Copy link

oklona commented Jan 26, 2024

Hmm... I just applied the fixes from ILI9341_2 as suggested by #550.

In plain English, I found the settings (lots of writecommands) here: [https://github.com/Bodmer/TFT_eSPI/issues/1172], and applied them to the init-function in lib/GxTFT/src/GxCTRL/GxCTRL_ILI9341/GxCTRL_ILI9341.cpp. Now my display (with USB-C, which seems to be the sign of the new revision of the board) actually comes up correctly after a regular rebuild/reflash!

So, this fix should probably be added to the official code. However, I am unsure what would be the best approach. I have seen some references to this TFT chip as ILI9342 instead of 9342, so the question is whether it should be implemented as a new driver (hugely based on the ILI9342 but with the init-function writing different values), or if the init function should just be updated for ILI9341. According to the TFT_eSPI post, it seems the changes should work for all displays, but obviously that should be tested and verified.

@zalves
Copy link

zalves commented Feb 13, 2024

@yeyeto2788 Thank you for the firmware! Working perfectly. When horizontal, touch is always mirrored, just had to calibrate touching the opposite corners that where request in calibration.

@fvanroie fvanroie added help wanted Extra attention is needed hardware New hardware or driver waiting feedback Feedback is required before the issue can be worked upon further and removed bug Something isn't working labels Feb 27, 2024
@fvanroie
Copy link
Collaborator

fvanroie commented Feb 27, 2024

I added a new ili9342 firmware, but can't test it myself. You can get it from the latest build in the Actions tab for testing.

Please let me know the result.

@fvanroie fvanroie self-assigned this Feb 27, 2024
@fvanroie fvanroie added this to the 0.7.x milestone Feb 27, 2024
@zalves
Copy link

zalves commented Feb 27, 2024

I've installed the ili9342 firmware and it still get part of the display scrambled, colors inverted.

IMG_1151

@zalves
Copy link

zalves commented Feb 27, 2024

The box does come with a sticker saying 7789 but I've tried the firmware with st7789 and got a messy result also. image

image

Only thing that worked visually was @yeyeto2788 build, but it doesn't get discovered by home assistant.

fvanroie pushed a commit that referenced this issue Feb 28, 2024
@fvanroie
Copy link
Collaborator

I swapped the width and height like @FreezyExp suggested, feel free to test again.

@zalves
Copy link

zalves commented Feb 28, 2024

I've tested, last build and display works fine :D configure display to 90º mirrored, calibrated touch by pressing opposite to target in calibration, otherwise it's inverted

Thank you @fvanroie

@fvanroie fvanroie added done The underlying issue has been fixed and removed waiting feedback Feedback is required before the issue can be worked upon further help wanted Extra attention is needed labels Mar 11, 2024
@smirnowegor
Copy link

I've tested, last build and display works fine :D configure display to 90º mirrored, calibrated touch by pressing opposite to target in calibration, otherwise it's inverted

Thank you @fvanroie

Hi! Did you calibrate it via GUI?
when i calibrate device it works fine ... until device is rebooted. Than i have to calibrate it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done The underlying issue has been fixed hardware New hardware or driver
Projects
None yet
Development

No branches or pull requests

8 participants