TFT with ILI9341 in SPI Mode Randomly Sleeps

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

Hello, I posted a similar topic in the Arduino.cc forums to no avail, but found an old thread here with the same issues.

I bought a TFT display breakout with a connected ILI9341 (product code 2478) to use with an Adalogger M0 (product code 2796). The display seems to work somewhat. Using only the provided libraries with the Arduino IDE and following this guide for SPI mode I had some intermittent issues.

When I first used it, the output randomly switched RGB modes and the display mirrored (text backwards) with the same code uploaded. Additionally, the screen would turn white after about 10 seconds which I found out was a sleep mode feature of the ILI9341 and could be reset with the SLPOUT command. Sleep mode would be re-enabled every few seconds after the first sleep.

I couldn't find a consistent cause for the issues, so I started checking out the diagnostics. The results of the serial monitor are as follows:

Code: Select all

FeatherWing TFT Test!
Display Power Mode: 0xCA
MADCTL Mode: 0x24
Pixel Format: 0x2
Image Format: 0xC0
Self Diagnostic: 0xE0
Strangely, the ILI9341 documentation has these results as undefined. For example, the self diagnostic result 0xE0 should always be 0xC0 and the third bit that turns that to E0 should never be 1.

Again, this old thread had the exact same results with the reversed text, "blank screen" (sleep mode), and abnormal diagnostic results.

In addition to the above isolated tests, I had issues using the breakout alongside other SPI devices in a project. However, for the sake of this thread it seems easier to tackle the issues presented above with the given diagnostic results.

Attached are images of the wiring setup. So far I've tried multiple breadboards, wires, and even a different Adalogger M0 (same model, friend owned). Any experience from the above post or additional help would be greatly appreciated.

Thanks
Attachments
MicrosoftTeams-image (2).jpg
MicrosoftTeams-image (2).jpg (195.42 KiB) Viewed 666 times
MicrosoftTeams-image (1).jpg
MicrosoftTeams-image (1).jpg (162.14 KiB) Viewed 666 times
MicrosoftTeams-image.jpg
MicrosoftTeams-image.jpg (167.87 KiB) Viewed 666 times

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

It may be soldering related. Some of the pins look like they might be cold soldered and not wetted out on the pads adequately. See here:
https://learn.adafruit.com/adafruit-gui ... n-problems

Try reflowing the pins and see if that helps.

User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

adafruit_support_carter wrote:It may be soldering related. Some of the pins look like they might be cold soldered and not wetted out on the pads adequately. See here:
https://learn.adafruit.com/adafruit-gui ... n-problems

Try reflowing the pins and see if that helps.
Alright, I gave that a shot today on the SPI pins to no avail - still the same diagnostic results. I checked the solder points on the back (IM1,2,3), reflowed them, and tested them with a DMM. They appear to be consistent with the schematic
MicrosoftTeams-image.jpeg
MicrosoftTeams-image.jpeg (122.56 KiB) Viewed 649 times

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

Oh, just noticed this in your serial output:

Code: Select all

FeatherWing TFT Test!
Be sure to use the correct example. You have the basic breakout, so run the non-FeatherWing version of the GFX test:
File -> Examples -> Adafruit ILI9341 -> graphicstest

User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

adafruit_support_carter wrote:Oh, just noticed this in your serial output:

Code: Select all

FeatherWing TFT Test!
Be sure to use the correct example. You have the basic breakout, so run the non-FeatherWing version of the GFX test:
File -> Examples -> Adafruit ILI9341 -> graphicstest
Okay, about right after Circled (filled) it goes into sleep mode. Same diagnostics as before though.

Code: Select all

ILI9341 Test!
Display Power Mode: 0xCA
MADCTL Mode: 0x24
Pixel Format: 0x2
Image Format: 0xC0
Self Diagnostic: 0xE0
Benchmark                Time (microseconds)
Screen fill              1238941
Text                     90221
Lines                    784463
Horiz/Vert Lines         103770
Rectangles (outline)     66490
Rectangles (filled)      2572071
Circles (filled)         333991
Circles (outline)        341336
Triangles (outline)      176271
Triangles (filled)       875962
Rounded rects (outline)  149756
Rounded rects (filled)   2570281
Done!
And I'm getting reversed screen writes like this:
MicrosoftTeams-image.jpeg
MicrosoftTeams-image.jpeg (163 KiB) Viewed 643 times

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

OK, let's try tying in the reset pin and see if that helps.

Connect RST to pin 11.

And then change the top of the graphicstest sketch to this:

Code: Select all

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
#define TFT_RST 11

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

adafruit_support_carter wrote:OK, let's try tying in the reset pin and see if that helps.

Connect RST to pin 11.

And then change the top of the graphicstest sketch to this:

Code: Select all

// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
#define TFT_RST 11

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
Ok, I did that and the text is printing out normally, but the diagnostic results and the sleep after Circle (filled) are the same. I've tried without

Code: Select all

while(!Serial) {}
at the start as well, but I think it just helps the diagnostics get transmitted on time.

Code: Select all

ILI9341 Test!
Display Power Mode: 0xCA
MADCTL Mode: 0x24
Pixel Format: 0x2
Image Format: 0xC0
Self Diagnostic: 0xE0
Benchmark                Time (microseconds)
Screen fill              1230911
Text                     90786
Lines                    794325
Horiz/Vert Lines         103150
Rectangles (outline)     66130
Rectangles (filled)      2555432
Circles (filled)         333494
Circles (outline)        345209
Triangles (outline)      178256
Triangles (filled)       871698
Rounded rects (outline)  150568
Rounded rects (filled)   2554157
Done!
MicrosoftTeams-image.jpeg
MicrosoftTeams-image.jpeg (196.44 KiB) Viewed 625 times

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

Are you basing sleep mode entirely on the behavior of the screen? And that is it goes white?

User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

adafruit_support_carter wrote:Are you basing sleep mode entirely on the behavior of the screen? And that is it goes white?
That and I can kick it out of the white screen using sendCommand(ILI9341_SLPOUT), but that was just a test in my larger program.

On that note, it also seems to interfere with other SPI devices (had some temp, voltage, and current sensor packages I picked up from here).

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

Do you think entering sleep mode correlates with time or with one of the function calls in the demo sketch?

The call to begin() includes sending SLPOUT:
https://github.com/adafruit/Adafruit_IL ... 1.cpp#L174
so not sure what is happening to make it go back. There doesn't seem to be any explicit command doing that.

User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

When I tested SLPOUT it would kick it out of sleep mode after the first time (around 12 seconds or so), then it would re-enter sleep mode after that at seemingly random intervals. The diagnostic results are completely messed up though. The self-diagnostic result of 0xE0 (1110 0000) should never have a 1 in that third bit as seen below from the datasheet.
diagnostic.jpg
diagnostic.jpg (90.63 KiB) Viewed 611 times
As far as I can tell the solder joints are fine, and have seen no difference in the diagnostic output between different wires, breadboards, Adalogger boards, or after reflowing joints. To follow up on some advice I've seen in other threads I checked the ribbon cable on the back of the display and it seemed fine, but I may try to use some needle-nose pliers or something to ensure it's fully in.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

The diagnostic output might be a red herring. Note the disclaimer in the function:
https://github.com/adafruit/Adafruit_IL ... 1.cpp#L318
Testing here, we get the exact same thing for a display that works:
gfx_test.jpg
gfx_test.jpg (43.36 KiB) Viewed 607 times
If you run the GFX test as is, does it "sleep" at the same point every time? If you rearrange the orders of the tests, does that change when it goes into "sleep"?

User avatar
Cottonwoods
 
Posts: 8
Joined: Mon Mar 02, 2020 2:42 am

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by Cottonwoods »

Ok, getting somewhere! testTriangles() is specifically causing it to enter sleep mode. In particular `tft.color565(i, i, i)` in this block:

Code: Select all

    tft.drawTriangle(
      cx    , cy - i, // peak
      cx - i, cy + i, // bottom left
      cx + i, cy + i, // bottom right
      tft.color565(i, i, i));
If I replace the values of i with i*10 or i+1 it works.

User avatar
adafruit_support_carter
 
Posts: 29150
Joined: Tue Nov 29, 2016 2:45 pm

Re: TFT with ILI9341 in SPI Mode Randomly Sleeps

Post by adafruit_support_carter »

If you modify the graphics test example sketch so your setup() and loops() are nothing but:

Code: Select all

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!"); 
 
  tft.begin();

  Serial.print(F("Triangles (outline)      "));
  Serial.println(testTriangles());

  Serial.println(F("Done!"));
}


void loop(void) {
}
All other code the same.

It still exhibits the behavior?

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”