ESP 32 SPI DMA Questions
-
- Posts: 7
- Joined: Thu Jun 08, 2017 10:11 pm
ESP 32 SPI DMA Questions
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
Thanks in advance,
awesome101
-
- Posts: 9769
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP 32 SPI DMA Questions
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.
If you have more sane datarates, then yes, the ESP32 will happily do DMA-driven SPI transfers.
-
- Posts: 7
- Joined: Thu Jun 08, 2017 10:11 pm
Re: ESP 32 SPI DMA Questions
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?
-
- Posts: 7
- Joined: Thu Jun 08, 2017 10:11 pm
Re: ESP 32 SPI DMA Questions
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?
-
- Posts: 7
- Joined: Thu Jun 08, 2017 10:11 pm
Re: ESP 32 SPI DMA Questions
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?
-
- Posts: 7
- Joined: Thu Jun 08, 2017 10:11 pm
Re: ESP 32 SPI DMA Questions
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?
-
- Posts: 9769
- Joined: Thu Nov 26, 2015 4:08 am
Re: ESP 32 SPI DMA Questions
(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.
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
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!
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!
-
- Posts: 7
- Joined: Thu Jun 08, 2017 10:11 pm
Re: ESP 32 SPI DMA Questions
Is 40 ms good for gaming
Re: ESP 32 SPI DMA Questions
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
https://en.wikipedia.org/wiki/Frame_rate
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Who is online
Users browsing this forum: Bing [Bot] and 66 guests