ESP 32 SPI DMA Questions

awesome101
Posts: 7
Joined: Thu Jun 08, 2017 10:11 pm

ESP 32 SPI DMA Questions

Postby awesome101 » Thu Jun 08, 2017 10:30 pm

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

ESP_Sprite
Posts: 9020
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP 32 SPI DMA Questions

Postby ESP_Sprite » Fri Jun 09, 2017 7:18 am

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.

awesome101
Posts: 7
Joined: Thu Jun 08, 2017 10:11 pm

Re: ESP 32 SPI DMA Questions

Postby awesome101 » Fri Jun 09, 2017 12:57 pm

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?

awesome101
Posts: 7
Joined: Thu Jun 08, 2017 10:11 pm

Re: ESP 32 SPI DMA Questions

Postby awesome101 » Fri Jun 09, 2017 6:36 pm

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?

awesome101
Posts: 7
Joined: Thu Jun 08, 2017 10:11 pm

Re: ESP 32 SPI DMA Questions

Postby awesome101 » Fri Jun 09, 2017 6:37 pm

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?

awesome101
Posts: 7
Joined: Thu Jun 08, 2017 10:11 pm

Re: ESP 32 SPI DMA Questions

Postby awesome101 » Sat Jun 10, 2017 1:48 pm

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?

ESP_Sprite
Posts: 9020
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP 32 SPI DMA Questions

Postby ESP_Sprite » Mon Jun 12, 2017 7:47 am

(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.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ESP 32 SPI DMA Questions

Postby loboris » Mon Jun 12, 2017 10:19 am

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!

awesome101
Posts: 7
Joined: Thu Jun 08, 2017 10:11 pm

Re: ESP 32 SPI DMA Questions

Postby awesome101 » Tue Jun 13, 2017 11:15 pm

Is 40 ms good for gaming

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: ESP 32 SPI DMA Questions

Postby kolban » Sat Jun 17, 2017 5:08 am

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
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

Who is online

Users browsing this forum: No registered users and 124 guests