ILI9341 Based Package from Adafruit Randomly Enters Sleep Mode

Hey all, I purchased this 2.4" TFT display with an ILI9341 breakout to use with an Atmel SAMD package they sell. I set it up for SPI using a provided tutorial and it looks great! I'm using the provided library based around their larger GFX library.

The one issue I'm having is after the first 10 seconds or so the screen will turn white. I dug around in the driver datasheet and realized it was initializing sleep mode with command 0x10 (pg 100). I currently work around this by sending the sleep out command 0x11 (pg 101) as often as possible to avoid too much downtime on the display. However, this feels wrong and looks unprofessional.

As far as I can tell from digging in the libraries there's no reason that the command would be sent in the first place, and all the graphics functions and tests have been smooth (except for inverted text - still not sure why it happened or how it 'fixed itself').

If anyone has some experience with this driver, the products, or similar issues I would appreciate any help on the matter.


Which library example is exhibiting this problem?

I have a regular 3.3V SPI display and regular M0 Pro. i…e. similar hardware.
So I can test the current Adafruit library code.


The graphicstest_featherwing example is displaying this issue. While I was using some custom graphics (which also had the problem with sleep mode, corrected by sending the sleep out command), once I uploaded the example again it started displaying the graphics mirrored. This happened earlier, as I mentioned the "inverted text", and I played around with setRotation to no avail. Randomly, the inverted/mirrored text was corrected on one subsequent upload despite no real code changes.

For some more information, I'm using the Arduino IDE to upload the code via "Adafruit Feather M0" board, "Arduino" USB stack, and "AVRISP mkII" programmer on Windows 10. I've tried other programmers and USB stacks.

edit: The display orientation is back to normal after uploading my code and unplugging/plugging it back in. I think this display controller may be sensitive to start-up conditions, and the sleep behavior is caused by a floating hardware reset line. In the morning I'll try attaching the hardware reset to a GPIO pin and handling it as part of the setup routine (and report back).

Adafruit generally have an external pullup resistor on the TFT_RST line.
Chinese Red SPI ILI9341 displays do not have pullup.
I doubt if you would get a problem with omitting TFT_RST

This means that Adafruit can provide examples with a cut-price constructor() which will work with Adafruit hardware but fail with Red displays.

I strongly recommend that you always use the full-fat constructor i.e.

Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

The Adafruit_SPITFT files have conditional code for Zero but not for M0 Pro.
It also seems to force USE_SPI_DMA for specific targets.

The graphicstest_featherwing example does this on my M0 Pro

Screen fill              1435064

i.e. crap performance.

What do you get?


I'm getting 1191196 on the Screen fill result, and the white screen still ends up after either the end of the graphicstest_featherwing or my own code with the reset pin connected to a GPIO and the 'full-fat' constructor. Looking at the header file for this Adafruit_ILI9341 lib the default reset pin is set to -1 and if so it uses a software reset in the constructor, so it doesn't seem to be the reset pin that's the issue.

It always uses the Software Reset.
It uses HWRESET if a TFT_RST pin is specified in the constructor().
It uses SWRESET if unspecified (i.e. TFT_RST = -1)
The Reset pin has a pullup. So it does not matter whether you use TFT_RST or not.

The theoretical time for fillScreen() is 768000us. i.e. 5 calls with SPI @ 12MHz

Your Featherwing is not using DMA.

I would always suspect intermittent faults on breadboard-style wiring.
A glitch in SCK can put the SPI out of sync.

Mind you, it is unlikely for a glitch to appear at exactly the same point in a program. (unless you are switching high currents and have poor VCC decoupling)


Edit. I have just checked current Adafruit code. Corrected my message.

I connected an external pullup resistor to the RST pin and a bypass cap to Vin, but I'm still getting sleep consistently after 10 seconds or so. I came across this old topic about noise causing issues on the SCK line, so maybe I just need the right decoupling setup?

I would be 100% confident in the Adafruit display and the Adafruit FeatherWing board. i.e. appropriate pcb layout and well placed decoupling capacitors.

So it comes down to the condition of any wiring between the two boards.

I have used Red SPI ILI9341 displays for several years. Always with 3.3V GPIO. And they work very well.


Ok, I'm getting this from the diagnostic test, so it definitely seems like something is wrong. I rebuilt it on the breadboard and am getting the exact same values. I'll try a new breadboard and see if that helps.

Display Power Mode: 0xCA
MADCTL Mode: 0x24
Pixel Format: 0x2
Image Format: 0xC0
Self Diagnostic: 0xE0

Although I found another old thread with the exact same diagnostic results, the random sleep mode (white screen), and the random reversed drawing. Could be that I just received a lemon.