ESP32-wSPIRAM/ili9488 doesn't work

Hi guys,

first of all, thank you very much kisvegabor/Amirgon and contributors for this awesome graphics library and the micropython bindings.

I try to use the release/v8 on ESP32-wSPIRAM with an ili9488 display, but I face some problems and I am stuck at this point. Maybe someone can enlighten me, on what I am doing wrong.

The Problem:
To build the firmware and deploy it on an ESP32 board is no problem (with the LV_CFLAGS="-DLV_COLOR_DEPTH=32"). But when I run a very simple example I don’t see the expected behavior on the display. I see a region that is gray, the lvgl active area. But most of the display doesn’t seem to be used. When I try to put a button then something happens (the orange stuff on the top appears, see the picture).

The code:

import lvgl as lv
from ili9XXX import ili9488
disp = ili9488(mhz = 5, factor=16)

btn1 = lv.btn(lv.scr_act())

What I did already to try to solve the problem:

  • I checked the forum and other examples.
  • I checked the display by a not lvgl driver. This works fine.
  • I checked the initialization, but this seems fine to me. Also, changes inspired by some other initialization routines don’t change this behavior. I also used the lvgl driver init and set than pixels by my own code, which was working fine and I had access to the whole display.
  • I compiled the firmware with different versions of espidf (4.0.2, 4.2, 4.4), didn’t help. I compiled lv_micropython master and release/v8, didn’t help. Older versions I didn’t manage to compile because of different error messages.
  • I tried to play around with the arguments of ili9488(), didn’t help. I tried to increase, reduce the resolution, the factor, and so on, didn’t help. Invert = True inverted the whole display (not just the “active” part).
  • I checked what is going on on the SPI lines with a logic analyzer. Everything seems to be fine. In particular, I checked what happens when I try to make a button on the display. There appear the 0x2A, 0x2B, 0x2C commands + data which should be fine. I am just a bit surprised, that the start column/row is zero and doesn’t go to high values (the values are 0x28 and 0x1C) when I try to place a button in the middle. The data after the ox2C seemed to be in the region of 17.000 Bytes, which is about half of what I would expect for a full display write (buf_size = 320 * 480 * 4 // 16).
    → This brought me to the suspicion that something with the frame buffer and/or the DMA transfer doesn’t work properly.

Maybe I am just stupid and there is a simple reason for this? Did anyone of you encounter this problem already? I have the feeling I overlook something stupid. Is this a problem with the color code? Thanks for helping me.

Hi @Tinkerer !

Some ideas:

  • Could it be related to power? How do you power your display and ESP32?
  • Is there any other device connected to the same SPI bus?
  • Did you try the other SPI bus? (spihost parameter)
  • Did you try both hybrid and pure-python modes? (hybrid parameter)
  • Did you try routing the SPI bus to other pins?
  • Did you try setting double_buffer to False?
  • Do you have another display you can test? Can you test ILI9341?
  • Do you have another ESP32 you can test?
  • Did you try to clean and rebuild your project? (well… always worth trying that too :wink: )

I only tested this with ILI9341 on ESP32 and it works well on both v8 and v9 (master).
The ILI9488 driver was contributed by @mhepp - perhaps he would have more ideas.

Dear @amirgon,

thank you very much for your suggestions and your time.

  • Power should be fine. I tried USB and external power.
  • No, there is no other SPI device (except of the xpt2046 on the display board).
  • Yes, every config of spihost.
  • in the ili9488 only hybrid is possible.
  • Yes, I tried to route to other Pins.
  • Yes, I tried both buffer modes.
  • No, I don’t have a ILI9341, but I guess I need to acquire one.
  • Yes, I tried also different ESP32 boards (also without SPIRAM).
  • Yes, at some point I was so frustrated, that I cleaned everything and made it from the scratch. Also lv_micropython and esp-idf.

This didn’t solve the issue. But it is good to know, that the ILI9341 should work, then I will test it with this once I have a display.

One additional side question maybe:
In the is mentioned:

# Default values of "power" and "backlight" are reversed logic! 0 means ON.
# You can change this by setting backlight_on and power_on arguments.

What means “0 means ON”? When I tried it was the opposite, 1 was ON. And this is also reflected in my understanding in the code by:

esp.gpio_set_level(self.backlight, self.backlight_on)

Yes, I can see how this can be confusing.

Historically, we only had a backlight parameter to specify the backlight pin (or “-1” to disable backlight). When turning it on, the backlight pin was set from high-impedance to 0 (because I had a P-Channel MOSFET to power it) but others didn’t like this reverse logic.

The problem was that we also needed to keep backward compatibility and couldn’t just flip it to 1.
So the solution was adding another parameter “backlight_on” who’s default value is 0 (on some displays), and stands for the value that should be set to the pin when backlight is turned “ON”.


Sets the level of the backlight pin to 0 in case backlight_on is 0.

Regarding the issue you have with ili9488, I suggest you open a new issue on lv_binding_micropython with all the information you provided here.
I don’t have an ili9488 so I can’t debug this, but hopefully someone else could.