Page 1 of 2

ESP 32 SPI DMA Questions

Posted: Thu Jun 08, 2017 10:30 pm
by awesome101
So before I buy the ESP 32 I just want to confirm that I can use my ESP32 to interface with my ILI9341 LCD via SPI using a pixel data buffer transmitted to the SPI FIFO register by DMA. Is this possible with the ESP32? I need this for a gaming library by the way so I need the display to update quickly (1000 microseconds or less). Some example code would be very helpful.

Thanks in advance,
awesome101

Re: ESP 32 SPI DMA Questions

Posted: Fri Jun 09, 2017 7:18 am
by ESP_Sprite
Erm, 1000uS for a full display refresh is a clock rate of 1.8GHz. No, neither the ILI nor the ESP32 can do that.

If you have more sane datarates, then yes, the ESP32 will happily do DMA-driven SPI transfers.

Re: ESP 32 SPI DMA Questions

Posted: Fri Jun 09, 2017 12:57 pm
by awesome101
Not sure how you calculated 1.8GHZ? The Teensy 3.5 which is less capable than the ESP32 is able to fill the screen in 1165 microseconds using a DMA buffer (https://forum.pjrc.com/threads/36706-IL ... y-3-6-only). The ESP32 is not capable of doing this?

Re: ESP 32 SPI DMA Questions

Posted: Fri Jun 09, 2017 6:36 pm
by awesome101
I'm not sure how you calculated 1.8 GHZ? The Teensy 3.5, which is less capable than the ESP32, can refresh the screen at a rate of at least 50 HZ via DMA. It takes the Teensy 1165 microseconds to fill the screen fully. Is this also possible with the ESP32?

Re: ESP 32 SPI DMA Questions

Posted: Fri Jun 09, 2017 6:37 pm
by awesome101
I'm not sure how you calculated 1.8 GHZ? The Teensy 3.5, which is less capable than the ESP32, can refresh the screen at a rate of at least 50 HZ via DMA. It takes the Teensy 1165 microseconds to fill the screen fully. Is this also possible with the ESP32?

Re: ESP 32 SPI DMA Questions

Posted: Sat Jun 10, 2017 1:48 pm
by awesome101
I read a topic in the PJRC forum where the Teensy 3.5 was able to do a 50HZ refresh rate. Is this also possible with the ESP32?

Re: ESP 32 SPI DMA Questions

Posted: Mon Jun 12, 2017 7:47 am
by ESP_Sprite
(You know you can edit your posts here?)
A full screen is 320x240x24 bit. Divide that by the amount of time you said it should take to upload, namely 1000uS, and you'll get a bit rate of 1.8GHz.

If you are OK with 16-bit color and 50Hz, you end up at (320*240*16)/(0.020)=61MBit. The absolute max for the ESP32 SPI is 80MHz, so at least in theory this should be doable if you queue/pipeline your transfers right.

However, the ILI9341 gives a minimum clock cycle length of 100nS, which translates to a maximum clock speed of 10MHz. So while you may be able to pump bits at 80MHz into it, you're operating outside the specs of your display controller.

Re: ESP 32 SPI DMA Questions

Posted: Mon Jun 12, 2017 10:19 am
by loboris
All ILI9341 and ILI9488 based display boards I've tested with ESP32 can work with up to 40MHz spi clock (tested by writing and reading data back for more than 24h without error). Maximal spi clock for read from display is 16MHz on ILI9488 and 40MHz on ILI9341.

The minimal (theoretical) time to fill the screen in 16-bit mode is ~30 ms. In real world application it is ~40 ms.
The time posted in PJRC forum ( ~1000 us) is the time to start the spi DMA transfer from application, not the actual spi transfer time.

The benefit of DMA spi transfer is that the processor can do some (useful) processing while the data is transfered.
The shortest transfer time is 0.2 us / byte
.

If you need faster than 40 ms screen fill time, you need to connect ILI9341 in parallel mode!

Re: ESP 32 SPI DMA Questions

Posted: Tue Jun 13, 2017 11:15 pm
by awesome101
Is 40 ms good for gaming

Re: ESP 32 SPI DMA Questions

Posted: Sat Jun 17, 2017 5:08 am
by kolban
If we can draw a screen in 40ms then that gives us 25 screens (frames) per second (1000/40). Here is an article on frame rates and thinking on video quality and perception.

https://en.wikipedia.org/wiki/Frame_rate