Jump to content
gmtii

[Energia Library] ILI9341 TFT 2.2 port

Recommended Posts

Got my new displays in, and got one working with the same text example... Tiva-C TM4C123GH6PM LaunchPad used here.

 

Two things:

1. Please include the FastDigitalWrite lib, I didn't have that; I found it over here: http://forum.stellarisiti.com/topic/675-solved%C2%A0launchpad-stellaris-on-energia-miso-erratic-behaviour-on-spi0-and-spi3/ (the SPI_all_ports_LM4F.zip file, I copied the FastDigitalWrite.* files over to get it working)

Looks like @@Rei Vilo wrote this one.

 

2. The Tiva-C shows as board not supported... Here's what I did to both FastDigitalWrite.h and TFTv2.cpp:

// Board check
#include "Energia.h"
#if defined(TARGET_IS_BLIZZARD_RB1) || defined(TARGET_IS_SNOWFLAKE_RA0)
#else
#error Board not supported.
#endif

.....

Thank you (and everybody). I put double slash  on these lines to simplify. 

post-2996-14264605409132_thumb.jpg

Share this post


Link to post
Share on other sites

With some additional hacking, my ILI9341-display connected to an EK-LM4F120XL ( One of those with LX4F120H5QR MCUs ) works with this library, too.

 

- A software reset was necessary in the init sequence, after the ReadID loop ( copied from Seeeds original code ):

      delay(500);
      sendCMD(0x01);
      delay(200);
 

- The SPI clock divider must be set to 1/8.   This may be due to my wiring - see photo.

     SPI.setClockDivider(SPI_CLOCK_DIV8);
 

- Drawing and text commands don't work while the backlight is on. Is that by design ?

 

Anyway the information posted here was quite helpful, thanks.

 

post-3397-14264605413776_thumb.jpg

Share this post


Link to post
Share on other sites

The backlight issue was kind of my fault - i used PD1 / Pin 24 which is connected to PB6 on the launchpad board. With any different pin the problem is gone.

Share this post


Link to post
Share on other sites

Hello and thank you for your porting of the library!

I've noticed, that this library ist really slim&fast (1-5x compared to ucglib or utft, even in HW-serial mode)!

The only drawback is that you cannot determine the screen direction (especally for printed text).

Does anyone knows a workaround for this?

 

Thank you

Regards

Matthias

Share this post


Link to post
Share on other sites

Ok, I've merged the newer version of the seeed library with the energia port.
Text rotation is now possible, but very disappointing and bad integrated, but for my purposes it works.
Note that the background color of the text wont work anymore, I've included a dummy variable for compatibility reasons. 
Modification and an example attached.

ILI9341_energia 2.zip

Share this post


Link to post
Share on other sites

<_< Nice work, but <driverlib/sysctl.h> dos unfortunate not reside in the CC3200 folder.....

 

Have been trying to get it to work, but i think my skills are just not there yet.

 

Since its a Cortex-M4 i guess it could do the trick.... ? 

 

 

You see these folks got a display working with the CC3200... http://e2e.ti.com/support/wireless_connectivity/f/968/t/352739.aspx

 

 

Couldt it be that my signals are getting lost in translation, since there is a logic level converter on my screen...?

 

The lib compiles..... 

 

#if defined(__arm__)
#include <inc/hw_types.h>
#include <inc/hw_memmap.h>
//#include <driverlib/sysctl.h>
#include <driverlib/pin.h>
#include <driverlib/gpio.h>
#else
#error Board not supported.
#endif
 
But no rectangles...

 

 

 

Edit: Never mind. I got it working with the above. SOLVED!

 

Now, the obvious question vis-a-vis the progress made on teensy 3.1.... Anyone up for some porting?

 

http://youtu.be/tioOB3Ysz70

 

There is no spoon..... 

 

post-4140-14264605471521_thumb.jpg

 

Share this post


Link to post
Share on other sites

Ok, I've merged the newer version of the seeed library with the energia port.

Text rotation is now possible, but very disappointing and bad integrated, but for my purposes it works.

Note that the background color of the text wont work anymore, I've included a dummy variable for compatibility reasons. 

Modification and an example attached.

Hi. In this library in functions drawNumber and drawFloat rotation does not run . For my purposes I modified your version of TFTv2.cpp (excuse my interrupting in your  text) . Now drawNumber and drawFloat run right with Tft.setDisplayDirect(UP2DOWN) only. Regards.

change.zip

Share this post


Link to post
Share on other sites

As a way to get my feet wet with @@Rei Vilo 's LCD_screen library, I am porting this over to his LCD_screen suite as a Screen_ILI9341.cpp/.h implementation.  Doesn't look all that hard and I'm hoping it goes quick ... as his suite appears to be quite rich in features!

Share this post


Link to post
Share on other sites

Nice, got it working; had to flip-flop the X-axis memory write orientation, and set the pixel mode correctly (16-bit RGB565 instead of 18-bit RGB666):

post-163-14264605504076_thumb.jpg

 

Also cool that the display's native RGB565 format is directly compatible with @@Rei Vilo 's choice of 16-bit color specifier in his library.

I noticed in the 0xF6 Interface Set command, you can doctor how it translates RGB565 to RGB666 internally ... it can "interpolate" the missing LSB from red & blue based on the value of Green, or just set the LSB to 0 every time.  Probably makes not a bit of difference visually though.

Share this post


Link to post
Share on other sites

Heh, I just realized today that the LED pin on the TFT display breakout board is the anode connection for the LED backlight, not a simple input to a buffer or something.  So it's pulling the LED's current from the Tiva's GPIO when you hook it up directly.  You can see the brightness change with MAP_GPIOPadConfigSet twiddling the GPIO_STRENGTH_* values between 2MA and 12MA.

 

I built a boosterpack to adapt this easily for plug & play use, but didn't account for that, luckily I haven't sold this to anybody :-)

Share this post


Link to post
Share on other sites

@@spirilis

 

Nice to know you managed to get the library working on your screen. 

 

The first test with scrambled text is typical of an orientation issue.

 

As a matter of facts, the very same LCD controller referenced ILI9341 could have various revisions, each one mentioned by the color of a tag on the removable protection. Even worse, some controllers are not genuine but "compatible with ILI9341", and have slight differences (like the one you've experienced) that make the developer crazy!

 

Enjoy the library!

Share this post


Link to post
Share on other sites

One more question! Have you manage to read the colour of a given pixel?

 

This feature isn't available in the ILI9340 on SPI mode.

Not yet but I know it "should"... the Seeed library reads the ID bytes to verify the controller. I'll have to try implementing readPixel soon!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×