Playing with timing code, in the graphics test code. In particular if we look at the test for fill screen,
It fills the screen several times with different colors.
So I instrumented the code both to print out delta millis, micros and to set a pin high and low...
unsigned long testFillScreen() {
digitalWriteFast(TIMING_PIN, HIGH);
unsigned long start = micros();
unsigned long startms = millis();
tft.fillScreen(ILI9341_BLACK); //1
digitalWriteFast(TIMING_PIN, LOW);
USERIAL->print(micros()-start, DEC);
USERIAL->write(":");
USERIAL->print(millis()-startms, DEC);
yield();
digitalWriteFast(TIMING_PIN, HIGH);
start = micros();
startms = millis();
tft.fillScreen(ILI9341_RED); //2
digitalWriteFast(TIMING_PIN, LOW);
USERIAL->write(' '); USERIAL->print(micros()-start, DEC);
USERIAL->write(":");
USERIAL->print(millis()-startms, DEC);
yield();
start = micros();
startms = millis();
digitalWriteFast(TIMING_PIN, HIGH);
tft.fillScreen(ILI9341_GREEN); // 3
digitalWriteFast(TIMING_PIN, LOW);
USERIAL->write(' '); USERIAL->print(micros()-start, DEC);
USERIAL->write(":");
USERIAL->print(millis()-startms, DEC);
yield();
start = micros();
startms = millis();
digitalWriteFast(TIMING_PIN, HIGH);
tft.fillScreen(ILI9341_BLUE); //4
digitalWriteFast(TIMING_PIN, LOW);
USERIAL->write(' '); USERIAL->print(micros()-start, DEC);
USERIAL->write(":");
USERIAL->print(millis()-startms, DEC);
yield();
start = micros();
startms = millis();
digitalWriteFast(TIMING_PIN, HIGH);
tft.fillScreen(ILI9341_BLACK); //5
digitalWriteFast(TIMING_PIN, LOW);
USERIAL->write(' '); USERIAL->print(micros()-start, DEC);
USERIAL->write(":");
USERIAL->print(millis()-startms, DEC);
USERIAL->write(" ");
yield();
return micros() - start;
}
When run on the M4 I see:
Self Diagnostic: 0xC0
490287
Benchmark Time (microseconds)
Screen fill 547389:842 547347:842 547417:842 547463:842 547499:841 547680
Text 109536
Lines 1056526
Horiz/Vert Lines 221860
Rectangles (outline) 141160
Rectangles (filled) 5681151
Circles (filled) 603924
Circles (outline) 462707
Triangles (outline) 244822
Triangles (filled) 1824043
Rounded rects (outline) 264109
Rounded rects (filled) 5645711
Done!
Notice the delta micros() value is completely screwed up.
But if I run it on the main M7 processor, we see the times:
Benchmark Time (microseconds)
Screen fill 367267:368 367248:367 367352:367 367296:368 367235:367 367465
Text 71891
Lines 694502
Horiz/Vert Lines 148984
Rectangles (outline) 94999
Rectangles (filled) 3826759
Circles (filled) 402205
Circles (outline) 304508
Triangles (outline) 161151
Triangles (filled) 1224348
Rounded rects (outline) 175109
Rounded rects (filled) 3796270
Done!
Notice the micros versus millis looks correct.
Also note: the M7 output is something like 2.25 times faster than the M4
With the SPI operations.

