ILI9341 based display in ESP32 - fast driver strategy


I am playing with ESP32 and an ILI9341 LCD.

Adafruit is putting a lot oft work creating good drivers and I am using their driver for that display in the ESP32.

Unfortunately it is quite slow on that hardware and slowest if using HW SPI.

Please prove me wrong if I am:

I think it is mainly because the data is written byte-wise using SPI.transfer().
SPI.transfer itself is not very fast because it is writing the byte and reads it afterwards to return it (I guess for checking that it has been written correctly).

I would like to write a faster driver as I need one for my project.

I am not sure what could be the best strategy for a fast driver so I hope you can tell me.

The fastest way would surely be to use a buffer in the ESP and write it to SPI via DMA. But in order to use the full 16bit color that buffer would crunch up a lot oft RAM.

My idea would be to use a small buffer (lets say some few hundred bytes) to collect some data and write it at once if the buffer is full or the user invokes the writing when neccessary.

I hope you habe some more ideas.
Thanks a lot in advance.

I found out that this library is slow because of an mutex lock in esp32_hal_spi .
Removing it makes it about 10 times faster.

I guess my homework now should be to learn why there is that mutex.

I guess my homework now should be to learn why there is that mutex.

Start your research here:

Most Arduino end-users are only aware that the Arduino runs under a task manager. The loop() must refresh every 30mS - 50mS or the native (RF) section will starve.

Of course, if you do not need WiFi, you can disable it:


I see from your post you were successful in getting the library to compile . . . can you share the changes to make it "work"?

I have just started using the WROVER-KIT which has the ILI9341 LCD.