Help with ILI9340 display
deʃhipu wrote 05/08/2016 at 12:04 • 1 pointI'm on my wit's end, so I thought maybe I will ask for help here. I'm trying to get to work an ILI9340-based LCD display. One of the cheap ones, not the ones from Adafruit. It looks like this:
I tried to use both the ILI9340 and ILI9341 Adafruit libraries both with 5V and 3.3V Pro Minis, both in hardware SPI and software modes. I tried the Adafruit Python ILI9341 library with the Raspberry Pi. I tried to swap the SPI pins, in case they are mislabeled on the display. I've even broken out my logic analyzer and tried to look at the traffic. All for nothing.
The display just shows a white screen, with some slight brightness changes while the "graphicstest" example runs.
Here's the photo of my connections:
http://paste.sheep.art.pl/d6a26e4f-bcf6-4998-b27c-64de13224d60/+inline
LCD Pro Mini
VCC -- VCC
GND -- GND
CS -- 10
RESET -- 8
DC/RS -- 9
SDI/MOSI -- 11
SCK -- 13
LED -- VCC with resistor
SDO/MISO -- 12
Has anybody gotten such a display to work? What's the trick? I have two of them, from different vendors, so the probability of them being broken seems low. I must be doing something wrong...
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Not sure of the difference between the ILI9340 and the ILI9341, but the 41 variant works fine with Arduino and Raspberry Pi with 3.3v logic and VCC 5V. Have you tested multiple displays?
Are you sure? yes | no
No, I only have this problem with this particular model, 2.2".
Are you sure? yes | no
gime koooooooooooooooooo
Are you sure? yes | no
Pardon?
Are you sure? yes | no
We use these all the time with Teensy. They work great! I wrote a highly optimized library for them (which is really *far* better than regular/slow Arduino... these displays have a lot of pixels to update).
https://github.com/PaulStoffregen/ILI9341_t3
They can be powered by either 5V or 3.3V, because it has an on-board 3.3V regulator. All the signals are 3.3V only. The RST pin can be connected to 3.3V. The ILI9341 controller has built in power-on reset, so pulsing RST is optional.
These displays do NOT work if you connect 5V signals to any of the pins (CS, RST, DC, SDI, SCK, etc). All the signals must be 3.3V. The only pin that can take 5 volts is the power input.
Are you sure? yes | no
Wait, doesn't it have a ILI9340 not a ILI9341?
Are you sure? yes | no
At least on the older Adafruit display with ILI9340, the same code work with either controller chip.
Are you sure? yes | no
I created a project at #Stubborn 2.2" TFT Display to better describe my findings and maybe some day figure out what is actually happening.
Are you sure? yes | no
I got it to work. Thank you everyone for the suggestions, that gave me the ideas to figure it out.
For the future generations: the secret is to have very exact voltage for the signals.
Turns out my display has built-in level shifters, and it expects 5V signal. So how come it didn't work with the 5V Pro Mini? Because I powered it from USB from my computer, and then the power goes directly to the VCC pin, and it's actually slightly more than 5V, so the signal was higher than 5V, and for some reason this display doesn't like that. But when I built a proper rig, and provided power to the RAW pin of the 5V Pro Mini, everything suddenly started working.
Thanks again for help!
EDIT: Actually, some measurements later, it's expecting ~3.6V signal. Pro Mini's internal regulator is dropping the 5V I give it on the RAW pin to about that voltage. That's why it works. It doesn't work with 5V (too high) nor 3.3V (too low).
Are you sure? yes | no
Yay :)
Are you sure? yes | no
Interesting! I wouldn't expect too such kind of problem. As for the solution you found have you tried a diode in series with module vcc? I mean from 5V to RAW pin?
Are you sure? yes | no
I'm really not sure what is actually happening there. I have one setup that works for some reason, and now I'm trying to figure out why.
Are you sure? yes | no
Have you tried this? - (also can't tell from the picture what voltage Arduino you are using but these displays are 3.3V logic and not 5V compatible.)
Are you sure? yes | no
I tried it with a 3.3V Pro Mini, so the level shifter shouldn't be necessary. I don't have any at hand to try right away, but that gave me an idea...
Are you sure? yes | no
have you tried to just pull the CS and RST lines up with a resistor, ignoring the arduino pins? I only have the 1.8 versions with the ST7735, otherwise I would check. Maybe it's something in the code you've overlooked? Like a missing arduino gfx lib or pinMode definitions?
Are you sure? yes | no
I think the CS has to be brought down (it's active low) at a specific moment synced with the clock, otherwise all the bytes you send would be shifted randomly? I'm not sure, new to debugging SPI -- it always just worked before. I can certainly try.
No overlooked pin definitions or dependencies -- it wouldn't compile then anyways.
Are you sure? yes | no
well I had multiple compiled programs where I forgot to set the pin as an output and it didn't work - so it's more an "I always forget" thing.
My uneducated opinion about CS is that if you only have one SPI device it doesn't really matter, just keep it active.
Are you sure? yes | no