I followed the tutorial (https://learn.adafruit.com/adafruit-2-8 ... eakout-v2/, SPI version), using the Adafruit ILI9341 and GFX libraries, and ran the test sketch on Raspberry Pi Pico and Arduino Uno. I wrote simple test sketches (code below) to measure the refresh time, and found 2.2s on the Pico, over 3s on the Uno, and 13ms on the PyGamer. I also found that if I only specify the CS and DC pins in the Adafruit_ILI9341 initialiser, I would get about 300ms on the Uno.
First off, I would like to understand why specifying all pins in the Adafruit_ILI9341 initialiser makes such a huge difference. The SPI pins I used are the default ones for the Uno, so I assumed passing those values would be equivalent to letting the library use the defaults.
Second, I would like to understand why the PyGamer refreshes so much faster. Here are a few things I thought:
- Even if the PyGamer has a smaller screen (160x128), that should only account for a factor of 4. Am I wrong?
- I did not specify a frequency for the SPI clock. Could that make a tangible difference? What could be a good frequency for my two controllers? What does the library default to if I don't specify it manually?
- The PyGamer page says it has "fast DMA support for drawing so updates are incredibly fast". I would like to understand that better, particularly if that's what I'm missing. Unfortunately, a quick Google didn't give me a good reference on what DMA is and how to use it, so a good source for that would be great. Is DMA a physical feature, something that a particular device either has or doesn't have? Or is it a particular way to set up the SPI bus? Can I use DMA to run my TFT, and how much faster would it make it?
Code: Select all
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#define TFT_DC 20 // 9 for the Uno
#define TFT_CS 17 // 10
#define TFT_COPI 19 // 11
#define TFT_CLK 18 // 13
#define TFT_RST 22 // -1
#define TFT_CIPO 16 // 12
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_COPI, TFT_CLK, TFT_RST, TFT_CIPO);
// Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC); // This makes the refresh 10x faster on the Uno!
unsigned long last_refresh;
void setup() {
tft.begin();
Serial.begin(9600);
Serial.println("ILI9341 Test");
}
void loop() {
last_refresh = micros();
tft.fillScreen(ILI9341_BLACK);
Serial.println(micros() - last_refresh);
}
Code: Select all
#include <Adafruit_Arcada.h>
Adafruit_Arcada arcada;
unsigned long last_refresh;
void setup() {
Serial.begin(9600);
arcada.arcadaBegin();
arcada.displayBegin();
arcada.setBacklight(250);
}
void loop() {
last_refresh = micros();
arcada.display->fillScreen(ARCADA_RED);
Serial.println(micros() - last_refresh);
}