Go Down

Topic: Problem with 2.2 TFT screen (Read 563 times) previous topic - next topic

MaxBoom66

I bought a 2.2 TFT screen with an ILI9225 IC.
When I connect this screen on the arduino with the code linked bellow a blanck screen appeared.
I have tried a lots of differents libraries and codes.

I count on your help.

PS: Sorry for my terrible english  :smiley-roll-sweat:

david_prentice

It should work just fine.   Use TFT_22_ILI9225 library.

Edit the Basic_Demo example:

Code: [Select]

// Include application, user and local libraries
#include "SPI.h"
#include "TFT_22_ILI9225.h"

#define TFT_RST A4 //8
#define TFT_RS  A3 //9
#define TFT_CS  A5 //10  // SS
#define TFT_SDI A2 //11  // MOSI
#define TFT_CLK A1 //13  // SCK
#define TFT_LED A0 //3   // 0 if wired to +5V directly

// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
//TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED);
// Use software SPI (slower)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED);



This bit-bashes SPI in software.   Matches your "wiring".

Alternatively wire each pin manually for the hardware SPI pins.

I would stick with the software SPI because life is easier when you can plug all the male pins into the Power/Analog headers.

Oh,  I have a GFX compatible library if you are interested.

David.

MaxBoom66

Thank you David,  I have tried to edit the Basic_Demo example like you said it but it seem don't work.
And I wired the screen directly on the arduino board with the Analog pins.

The code :


Code: [Select]

// Include application, user and local libraries
#include "SPI.h"
#include "TFT_22_ILI9225.h"

#ifdef ARDUINO_ARCH_STM32F1
#define TFT_RST PA1
#define TFT_RS  PA2
#define TFT_CS  PA0 // SS
#define TFT_SDI PA7 // MOSI
#define TFT_CLK PA5 // SCK
#define TFT_LED 0 // 0 if wired to +5V directly
#else
#define TFT_RST A4
#define TFT_RS  A3
#define TFT_CS  A5  // SS
#define TFT_SDI A2  // MOSI
#define TFT_CLK A1  // SCK
#define TFT_LED 0   // 0 if wired to +5V directly
#endif

#define TFT_BRIGHTNESS 200 // Initial brightness of TFT backlight (optional)

// Use hardware SPI (faster - on Uno: 13-SCK, 12-MISO, 11-MOSI)
//TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_LED, TFT_BRIGHTNESS);
// Use software SPI (slower)
TFT_22_ILI9225 tft = TFT_22_ILI9225(TFT_RST, TFT_RS, TFT_CS, TFT_SDI, TFT_CLK, TFT_LED, TFT_BRIGHTNESS);



Clément.

david_prentice

#3
Jan 12, 2018, 08:37 am Last Edit: Jan 12, 2018, 12:44 pm by david_prentice
Go on.   I would guess that the library author has tested her example on a real Arduino.
My copy has no mention of STM32.    Are you sure that you don't have a hacked library?

I installed my copy of that library a few years ago.
I am not at a PC.   I will Google for TFT_22_ILI9225 and see what comes up today.

Life is so much better with the Library Manager.   At least you can avoid hacked libraries from suspect internet sites now.    And you get a version number.

David.
Edit.   I found the original library on GitHub.
I also found an old fork

I replaced my old library with the Nkawu one.   It is v1.3.4 and is recognised by Library Manager
It works with the Software constructor and Shield plugged into Analog/Power headers.
It also works with regular Hardware constructor when wired to Uno SPI pins.

My board has a LED pin.    It requires 5V GPIO to turn it on.   Uno GPIO should not switch > 20mA.
Later boards have the LED hard-wired i.e. not under program control.

MaxBoom66

The library I am using coming from the Library manager, it is the official Nkawu library. I have tried the old version you have linked in your precedent post and nothing append; The screen stay white.
I 'm starting to think my board is dead. It is strange because I have it juste since 3 days.

Clément.

david_prentice

Your board does not have an LED pin.   So I would assume it is always powered by VCC.
Since it is NC,  the define does not matter.  #define TFT_LED 0   // 0 if wired to +5V directly

Your photo shows the board correctly mated to your Uno.  CS is plugged into Uno Analog #5.   
Your code in #2 looks fine.

Seriously,   I would expect everything to work ok,  albeit SLOWLY.

Do you see a White screen or a Black screen?

David.

MaxBoom66


david_prentice

It shows that your backlight LED is working.

Quite honestly,  you can't go wrong with plugging into the Analog / Power headers.
Manual wiring is fraught with problems:   wrong wiring,  broken wires,  ...

Of course the display might be broken.
Or you have already let some smoke out,  and not told anyone.

I would try on anther Uno, Mega, ...
If no success,  ask for your money back.

David.

MaxBoom66

Ok I will try with another board like mega.
If the screen continue to not work I will buy an another.

Thank you very much for all your help.

david_prentice

What is your ultimate goal?   

176x220 is not a very convenient size.
Plugging into Analog/Power headers is not as convenient as a regular Uno shield.
Your 176x220 has 5V->3.3V level shifters.

240x320 Parallel shields are cheap but use most pins.
240x320 SPI shields are more expensive but allow spare GPIO, I2C, SPI, ... pins.

The popular Red ILI9341 SPI/Touch boards are cheap but require 3.3V logic.

David.

Go Up