ESP32 SPI DMA not enabled when using TFT_eSPI with Arduino as a component in ESP-IDF #1304
-
I goofed and posted this originally in 'Issues'. I think it's more appropriate here. Today, I encountered an issue with slow screen refreshes when using TFT_eSPI with Arduino as a component under ESP-IDF. I was able to track the problem down to ESP32_DMA not being enabled. When I use the TFT_eSPI library in the Arduino IDE or in PlatformIO with just the Arduino framework, ESP32_DMA is enabled seemingly by default and screen refreshes are quick as expected. If I instead use ESP-IDF with Arduino as a component in PlatformIO, ESP32_DMA is not enabled by default and screen refresh performance suffers. Here are two simple test programs to illustrate. More configuration details are in the platform.ini for each project. I've tested this on both ESP32-WROOM-32D and ESP32-WROVER-E modules and the results are the same. This one uses just Arduino framework: https://github.com/caiser01/Arduino_TFT_DMA_check This one uses ESP-IDF with Arduino as a component: https://github.com/caiser01/ESP-IDF_TFT_DMA_check Both programs check whether ESP32_DMA is enabled and then measure the time it takes to fill the screen with solid red, green, and blue. Here is sample output I got from running each program: PlatformIO, Arduino framework:
PlatformIO, ESP-IDF with Arduino as component:
As you can see the draw time in the second case is more than 3 times greater than in the first. My question is, how do I get ESP32_DMA to be enabled for the second case where I'm using ESP-IDF with Arduino as a component? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Bodmer came through with the solution here: #1301 When using TFT_eSPI with Arduino as a component under ESP-IDF in PlatformIO, you need to add: For my ESP-IDF example above, the complete correct build_flags section looks like:
This results in the faster screen refreshes as expected. Thanks to Bodmer! |
Beta Was this translation helpful? Give feedback.
Bodmer came through with the solution here: #1301
When using TFT_eSPI with Arduino as a component under ESP-IDF in PlatformIO, you need to add:
-DESP32=1
under build_flags in order for the ESP32 optimized SPI code to be compiled.
For my ESP-IDF example above, the complete correct build_flags section looks like: