I was just experimenting with my Adafruit Display which is using an ILI9340 Chip. It was quite slow so I tried to tweak it a little bit. The first thing that came to my mind was to change the clockdiver.
Im using this libary: GitHub - adafruit/Adafruit_ILI9340: This is a library for the Adafruit 2.2" SPI display.
Stock clockdivider is 11 which is 7-6Mhz
Adafruit 2.2" SPI TFT Test! Benchmark Time (microseconds) Screen fill 1913383 Text 121685 Lines 1147001 Horiz/Vert Lines 157330 Rectangles (outline) 101025 Rectangles (filled) 3972593 Circles (filled) 610004 Circles (outline) 500776 Triangles (outline) 363771 Triangles (filled) 1314108 Rounded rects (outline) 221244 Rounded rects (filled) 4345116 Done!
I changed it to 9
Benchmark results. Clockdivider = 9
Adafruit 2.2" SPI TFT Test! Benchmark Time (microseconds) Screen fill 1803141 Text 116696 Lines 1100386 Horiz/Vert Lines 147317 Rectangles (outline) 94720 Rectangles (filled) 3743585 Circles (filled) 579950 Circles (outline) 480619 Triangles (outline) 348937 Triangles (filled) 1227087 Rounded rects (outline) 210705 Rounded rects (filled) 4093446 Done!
Which was a little bit better… Now, I just wanted to know the limit of the Display (or what happens when the signal is to fast). So I changed it to 2
Benchmark results. Clockdivider = 2
Adafruit 2.2" SPI TFT Test! Benchmark Time (microseconds) Screen fill 1290915 Text 92619 Lines 872079 Horiz/Vert Lines 105513 Rectangles (outline) 68141 Rectangles (filled) 2680671 Circles (filled) 434087 Circles (outline) 380752 Triangles (outline) 276503 Triangles (filled) 882989 Rounded rects (outline) 162050 Rounded rects (filled) 2938015 Done!
Hm, I was puzzled… The screen is very fast and even the lines and small letters were without any fault. I thought there would be some kind of dead pixels or something, but nothing. The Display is cripy as always…
It was even working with a clockdivider of 1, so at full speed 84Mhz!
After this I tried the new “Sam feature”, adding the SPI Pin for this mode and it made it terrible slow
Benchmark results. SPI.setClockDivider(2,_cs)
Benchmark Time (microseconds) Screen fill 1876418 Text 120145 Lines 1132974 Horiz/Vert Lines 153278 Rectangles (outline) 98503 Rectangles (filled) 3896083 Circles (filled) 600755 Circles (outline) 494876 Triangles (outline) 359256 Triangles (filled) 1276280 Rounded rects (outline) 217630 Rounded rects (filled) 4259117 Done!
Can anyone explain what is happening? Is the display really running at 42Mhz? And why is the new function slowing it down so much? I’d really like to use the SPI mode for specific Pins, but not when it is that slow. I think then it will be faster to write your own output specific Clockdivider function.