This project uses the esp-open-sdk SDK, with a custom lcd driver and custom server to draw images as fast as possible to an ILI9431 tft display.
I wanted to optimize FastBMP even further. Starting off with the Blinky example & awesome Makefile, I created this project in order to avoid the Arduino libraries overhead.
The lack of official documentation on the esp8266 chip is quite unfortunate. Because of that, I used a logic analyzer from the start. Replicating the initialization routine and getting the LCD to fill one color took me roughly one night. While the initilization commands / data values were copy/pasted from Adafruits library (no shame, the lcd datasheet doesn't really cover in depth the init wizardery), the rest of the code was developped independently while looking at the output from the Saleae Logic software.
My WeMos D1 Mini also gave me issues with esptool.py, but thankfully using a different baud rate seemed to solve the issue for me.
Adafruits original startup routine, as captured by Saleae Logic. Surprisingly, a lot of time spent in-between SPI transactions!
Somewhat optimized routine, ommitting the CS signal as shown optional by the datasheet. Also showing 24-bit SPI transactions.
Since SDA/SLC are handled by the SPI library (CS too, turns out!), we only need to make sure DC is LOW during commands, and HIGH during data transfers. Optionally CS can be kept LOW during larger transfers.
- Very low overhead: uses RTOS and HSPI driver, everything else is custom.
- Display initilization routine rewritten to be faster, more compact.
- Uses all 16 SPI registers for 64-bytes transactions when needed.
- Faster SPI communication with the display.
- Custom image format (RGB565 really) means no data conversion.
- Look into DMA possibilities. doable in UART
- Falling / Rising edge triggers, SPI Mode (single/double/quad?)
- Assembly, although I'm not interested
- Switching to software SPI that runs at optimal frequency.
- "Faster GPIOs on ESP8266" by WDIM0
- "ESP8266 Output GPIO and Optimization" by OpenMYR
- "HSPI Clock Configuration Registers Explained" by MetalPhreak
- "ESP8266 native SPI hardware driver" (SPI registers observations) by MetalPhreak
- ILI9341 datasheet by Adafruit
- ESP8266 Technical Reference and ESP8266 Specifications by Espressif