Jump to content
43oh

Adafruit ILI9341 port for Energia


Recommended Posts

Adafruit ILI9341 is an Arduino library for ILI9341 TFT display. This is a cheap controller and display module that can be bought on ebay/aliexpress fror as low as 6$.

 

Recently I experimented with porting this library to Energia. Not surprisingly, it was almost trivial since most of the low level stuff is abstracted by SPI library functions.

 

The port itself: https://github.com/alkhimey/Adafruit_ILI9341/tree/msp430-support

Wiring instructions: http://www.nihamkin.com/2016/04/30/connecting-msp430-with-ili9341-tft-display/

 

This might be a little redundant as I see now that there is a dedicated msp430 graphics library that supports this display, still I want to believe it has some value for the community.

 

post-48694-0-89122200-1462137258_thumb.jpg

 

 

Link to post
Share on other sites

Hi @@artium

 

Thank you very much for making this library available.

I compiled it on a F5529 launchpad without issue (needed to adapt the pins slightly)

I am trying to get it working on the msp432 now, however I am running into problems.

 

First it mentions that min(,) is not defined, this is easily circumvented with two definesat the top of the sketch: https://github.com/energia/Energia/issues/815

Then I changed volatile RwReg with volatile int32_t in the h file where the SPI pin pointers are defined.

 

Unfortunately, now the compiler tells me that digitalpintoport and associated functions are not defined. Do you or anyone have any hints? I'll upload the exact error message tonight, this is from memory...

Link to post
Share on other sites

This library was developed by Adafruit so the thanks should go to them.  ;)

 

The following macros are not implemented in Energia:

  • digitalPinToPort
  • portOutputRegister
  • digitalPinToBitMask

 

As a temporary workaround, you can comment the line:

#define USE_FAST_PINIO

in Adafruit_ILI9341.h.

 

Also, it would be better to use volatile uint32_t as replacement for RwReg (this is how it is typedefed for Arduino).

 

I do not have msp432 to test, but I was able to compile using the three fixes (min/max, RwReg and USE_FAST_PINIO).

 

If you manage to compile and run the example sketch, can you post the benchmark result?

Link to post
Share on other sites

Hi @@artium,

 

thank you very much (and also adafruit :D)

I ran the benchmarks on my msp432 launchpad and also on my msp430f5529 launchpad (25 MHz), here with #define USE_FAST_PINIO commented for both.

 

msp432
Display Power Mode: 0x9C
MADCTL Mode: 0x48
Pixel Format: 0x5
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              31922493
Text                     1787874
Lines                    17494289
Horiz/Vert Lines         2618766
Rectangles (outline)     1675845
Rectangles (filled)      66276560
Circles (filled)         9775988
Circles (outline)        7653239
Triangles (outline)      5548662
Triangles (filled)       21812339
Rounded rects (outline)  3461099
Rounded rects (filled)   72269681
Done!


msp430f5529
ILI9341 Test!
Display Power Mode: 0x60
MADCTL Mode: 0x0
Pixel Format: 0xFF
Image Format: 0x0
Self Diagnostic: 0x0
Benchmark                Time (microseconds)
Screen fill              2263167
Text                     340734
Lines                    3615312
Horiz/Vert Lines         195546
Rectangles (outline)     133089
Rectangles (filled)      4699971
Circles (filled)         1194204
Circles (outline)        1580064
Triangles (outline)      1146462
Triangles (filled)       1952517
Rounded rects (outline)  558189
Rounded rects (filled)   5281704
Done!

 

 

The 432 seems to be significantly slower in everything than the 5529, which I don't understand yet. (I did use uint32_t, I forgot which one I used when writing the forum post away from my home computer)...

Link to post
Share on other sites
  • 4 weeks later...

Hi @@artium

 

Thank you very much for making this library available.

I compiled it on a F5529 launchpad without issue (needed to adapt the pins slightly)

I am trying to get it working on the msp432 now, however I am running into problems.

 

First it mentions that min(,) is not defined, this is easily circumvented with two definesat the top of the sketch: https://github.com/energia/Energia/issues/815

Then I changed volatile RwReg with volatile int32_t in the h file where the SPI pin pointers are defined.

 

Unfortunately, now the compiler tells me that digitalpintoport and associated functions are not defined. Do you or anyone have any hints? I'll upload the exact error message tonight, this is from memory...

Thanks to all who've contributed.  This saved me hours of spelunking!!!

 

>I compiled it on a F5529 launchpad without issue (needed to adapt the pins slightly)

Yes.  FWIW, based on the BoosterPack "standard" definitions:

MOSI - P3_0

MISO - P3_1

CLK - P3_2

and

TFT_DC P2_3 (CS other)

TFT_CS P2_6 (CS display)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...