Adafruit_ILI9341_STM - improvements

Working libraries, libraries being ported and related hardware
stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Adafruit_ILI9341_STM - improvements

Post by stevestrong » Sat Aug 05, 2017 1:12 pm

Hi all,

I was recently involved in a ILI9341 related project and missed some features which were already implemented in the original Adafruit lib but not yet in our STM32 variant.

Therefore I added following features to the Adafruit_ILI9341_STM library from Roger's repo:

- push (RGB565) pixel data array to the LCD (already committed in the Roger's repo)
- possible to pass an SPI class object reference and SPI clock frequency in main sketch without editing any lib file
- fix reading single + implement reading multiple pixels
- some speed improvements (by optimizing DC and CS pin toggling)

The graphicstest has been extended with single+multiple pixel read test.

Actual benchmark (CPU@72MHz, SPI_1@36MHz):
new ILI9341 benchmark.jpg
new ILI9341 benchmark.jpg (80.28 KiB) Viewed 843 times
I would like to ask you to test it, as far as you have time and/or need some of these new features.

You may probably need to update the SPI lib to include the dual 8 bit read/write function (in 8 bit mode): https://github.com/rogerclarkmelbourne/ ... es/SPI/src

You may also need the Streaming library, to be placed under /Arduino/libraries/ folder.

The code is attached as ZIP but can also be downloaded from here: https://github.com/stevstrong/Arduino_S ... LI9341_STM

Any comments/suggestions are welcome here.
Bug reports on github, please
Attachments
ArduinoStreaming.zip
(3.71 KiB) Downloaded 41 times
Adafruit_ILI9341_STM.zip
(33.15 KiB) Downloaded 45 times
Last edited by stevestrong on Sun Aug 06, 2017 2:57 pm, edited 1 time in total.

User avatar
Pito
Posts: 1628
Joined: Sat Mar 26, 2016 3:26 pm
Location: Rapa Nui

Re: Adafruit_ILI9341_STM - improvements

Post by Pito » Sat Aug 05, 2017 2:07 pm

Under Sloeber, Roger's latest (with SPI as above), Maple Mini @72MHz, SPI2 (18MHz)

Code: Select all

ILI9341 Test!
Display Power Mode: 0x9C
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x9C
Self Diagnostic: 0xC0

Read single pixel test
------------------------------
Write pixel: 0x1234
Read pixel: 0x1234

Read multiple pixel test
------------------------------
Write pixels: 0x1234, 0x5678, 0x9012, 0x3456
Read 4 pixels: 0x1234, 0x5678, 0x9012, 0x3456
Benchmark                Time (microseconds)
Screen fill              341489
Text                     43819
Lines                    226266
Horiz/Vert Lines         29315
Rectangles (outline)     19360
Rectangles (filled)      709364
Circles (filled)         154906
Circles (outline)        180807
Triangles (outline)      51422
Triangles (filled)       261140
Rounded rects (outline)  67645
Rounded rects (filled)   789560
Done!
Pukao Hats Cleaning Services Ltd.

stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Adafruit_ILI9341_STM - improvements

Post by stevestrong » Sat Aug 05, 2017 7:39 pm

Pito, thanks for testing.

User avatar
RogerClark
Posts: 7485
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Adafruit_ILI9341_STM - improvements

Post by RogerClark » Sat Aug 05, 2017 11:17 pm

Steve

Thanks


I have tested the latest library, using copy in the zip and it seems to work OK.

I'm not sure why when I pulled from your repo, it didnt work for me.

One minor thing which caught me out with the new version of the graphics test, is that it does not run unless the serial monitor is open.

I also think there could be conflicts by requiring Arduino Streaming to use the graphics lib, unless we include that lib as part of the core install.
But people may already have it installed, and we'd then need to keep our copy of it, up to date with the master version

I think its easier simply to include Streaming.h in the example folder and reference that version.

If we're going to update the graphics test, we should remove all the F() macros used in printing the text etc


I will need to compare the speed / Time with the previous version of the lib, just to make sure the all look OK to me.

BTW.

I've also tried running it with differen optimisation and it seems to work fine.
Strangely -O2 is slower for Text than -Os but -O3 is faster and -O3 + LTO is even faster than that.

victor_pv
Posts: 1750
Joined: Mon Apr 27, 2015 12:12 pm

Re: Adafruit_ILI9341_STM - improvements

Post by victor_pv » Sun Aug 06, 2017 2:53 pm

Why are Pito's test results so much slower than Steve's?

stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Adafruit_ILI9341_STM - improvements

Post by stevestrong » Sun Aug 06, 2017 2:59 pm

Because I tested on SPI_1 @36MHZ, and Pito tested on SPI_2@18MHz.

User avatar
Manny
Posts: 41
Joined: Wed Dec 09, 2015 3:15 pm

Re: Adafruit_ILI9341_STM - improvements

Post by Manny » Wed Aug 16, 2017 5:50 pm

Hi Steve, I tried the bechmark sketch and I could not get any display on the screen unless i used a SPIClass

Code: Select all

static SPIClass _spi(1);
  tft.begin(_spi); //worked
  tft.begin(); // no display 
Appreciate your ongoing contribution to the community.

User avatar
martinayotte
Posts: 1229
Joined: Mon Apr 27, 2015 1:45 pm

Re: Adafruit_ILI9341_STM - improvements

Post by martinayotte » Wed Aug 16, 2017 5:52 pm

@Manny, why are you posting 3 times the same post using replies ?

User avatar
Manny
Posts: 41
Joined: Wed Dec 09, 2015 3:15 pm

Re: Adafruit_ILI9341_STM - improvements

Post by Manny » Wed Aug 16, 2017 5:57 pm

martinayotte wrote:
Wed Aug 16, 2017 5:52 pm
@Manny, why are you posting 3 times the same post using replies ?
Haha must be losing it, wont even let me delete them because they have been replied too :oops:

stevestrong
Posts: 1829
Joined: Mon Oct 19, 2015 12:06 am
Location: Munich, Germany

Re: Adafruit_ILI9341_STM - improvements

Post by stevestrong » Thu Aug 17, 2017 5:14 pm

Guys, im on holliday currently, will be back in a week or so.

Post Reply