Go Down

Topic: LCD display with ILI9341 driver on Arduino (Read 326326 times) previous topic - next topic

mrburnette


I have connected Arduino through CD4050BE to ILI9341 by scheme below and display works fine, but i don't understand how to connect SD-card. I tried to connect SD_MOSI, SD_MISO, SD_SCK jointly with MOSI, MISO, SCK from TFT-display and SD_CS into D4, but it doesn't work. Anybody help me make it work...


Reply #94 worked for one member

Ironic62

Hi all !

3 days i read, i read and i read.
3 days i try, i try and i try.

I do Many things but i am disappointed

I have a ILI9341 LCD TFT, the same as most people here.
I have a CD4050.
i have a 3.3v power supply.
And i have un Arduino uno and a nano (328).


Arduino -> CD4050 -> ILI9341
sclk= 13
miso = 12 (direct arduino TFT)
mosi = 11
cd= 6
cs = 5
reset = 4

I Power LCD and CD4050 with 3.3v from power supply (grounded to arduino GND).
I Use a cap near TFT and CD4050.



All is ok, i can run libraries (ILI9341/SeeedTFTv2/AdaFruit9341/UTFT/Ucglib/MultiLCD).

But : I can't run Fast SPI (HW SPI) on AdaFruit, UTFT and Ugclib.


MultiLCD is probably the most speed, it run HW SPI (i think) but it's very limited functions.
ILI9341/SeeedTFTv2 run fast but no landscape possibility.

- Adafruit is very slow with :
Adafruit_ILI9341 tft = Adafruit_ILI9341(5, 6, 11, 13, 4, 12); : WORKS
Adafruit_ILI9341 tft = Adafruit_ILI9341(5, 6, 4); WHITE SCREEN

- Ucglib is very slow too :
Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4);  WORKS
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4); WHITE SCREEN

- UTFT is SW SPI Only (i Think).



ILI9341/SeeedTFTv2/MultiLCD are probably *10 faster.


SD Card isn't wired.
I tried it and it works (so HW SPI WORKS ?) Show directoty/read/write/infos... from serial monitor
BUT it doesnt' work if i try to use TFT together (SW and HW mode)


I Tried with Uno and Nano, same result.
CD5040 isn't bad, FAST SPI works with some libraries.



I read someone have the same issue in this topic (i think).
I don't know where is the problem.


Anyone have an idea ?


(Sorry for my english).








JMe87

Hi Ironic,
read my message here :
http://forum.arduino.cc/index.php?topic=241891.msg1742065#msg1742065

Work perfectly with adafruit library and without any 4050, only 10 resistors.
Jacques

nid69ita

??? ironic ?
5 lines must be converted from 5V to 3,3V, so a simple "voltage divider" is sufficient.
5 lines, x 2 resistors (voltage divider) = 10 resistors  :D
my name is IGOR, not AIGOR

mrburnette


??? ironic ?
5 lines must be converted from 5V to 3,3V, so a simple "voltage divider" is sufficient.
5 lines, x 2 resistors (voltage divider) = 10 resistors  :D


Or, simply use a 3.3V 8MHz Pro Mini:
https://www.sparkfun.com/products/11114

Or, build a flat-duino at 8MHz:
http://www.hackster.io/rayburne/flat-duino

Or, use a 3.3V 8MHz Pro Micro:
https://www.sparkfun.com/products/12587

Or, try your hand at running a 16MHz Pro Mini at 3.3V knowing this is outside the published specifications.

Ray

casemod

#125
Jun 09, 2014, 02:45 pm Last Edit: Jun 09, 2014, 02:51 pm by casemod Reason: 1

Hi all !

3 days i read, i read and i read.
3 days i try, i try and i try.

I do Many things but i am disappointed

I have a ILI9341 LCD TFT, the same as most people here.
I have a CD4050.
i have a 3.3v power supply.
And i have un Arduino uno and a nano (328).

Arduino -> CD4050 -> ILI9341
sclk= 13
miso = 12 (direct arduino TFT)
mosi = 11
cd= 6
cs = 5
reset = 4

I Power LCD and CD4050 with 3.3v from power supply (grounded to arduino GND).
I Use a cap near TFT and CD4050.

All is ok, i can run libraries (ILI9341/SeeedTFTv2/AdaFruit9341/UTFT/Ucglib/MultiLCD).

But : I can't run Fast SPI (HW SPI) on AdaFruit, UTFT and Ugclib.

MultiLCD is probably the most speed, it run HW SPI (i think) but it's very limited functions.
ILI9341/SeeedTFTv2 run fast but no landscape possibility.

- Adafruit is very slow with :
Adafruit_ILI9341 tft = Adafruit_ILI9341(5, 6, 11, 13, 4, 12); : WORKS
Adafruit_ILI9341 tft = Adafruit_ILI9341(5, 6, 4); WHITE SCREEN

- Ucglib is very slow too :
Ucglib_ILI9341_18x240x320_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4);  WORKS
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4); WHITE SCREEN

- UTFT is SW SPI Only (i Think).

ILI9341/SeeedTFTv2/MultiLCD are probably *10 faster.

SD Card isn't wired.
I tried it and it works (so HW SPI WORKS ?) Show directoty/read/write/infos... from serial monitor
BUT it doesnt' work if i try to use TFT together (SW and HW mode)


I Tried with Uno and Nano, same result.
CD5040 isn't bad, FAST SPI works with some libraries.

I read someone have the same issue in this topic (i think).
I don't know where is the problem.
Anyone have an idea ?
(Sorry for my english).


Seems to me you only have the software SPI working?
I know it may sound a bit obvious but when you have

Code: [Select]
Ucglib_ILI9341_18x240x320_HWSPI ucg(/*cd=*/ 6 , /*cs=*/ 5, /*reset=*/ 4); [b]WHITE SCREEN[/b]

you also have to connect pin 13 to SCK and pin 11 to MOSI on the display. In addition to CD, CS and RST. So this gives you 5 wires for the LCD, plus Power, Backlight (trough a 10Ohm resistor @ 3V3) and GND.

Just a note: Using the suggestions somewhere on this post i got an error initializing the card (something along the lines of wrong display, looking for ILI 9141 found 0x0000). This is because some displays don't report the serial number. Avoid using such library

I personally tried a bunch of displays yesterday using both Adafruit and UCGLIB and they both worked, so i advise you to try again. Perhaps power your arduino from 3V3 to avoid the CD4050 just until you find a combination that works and then put the CD4050 back and fire it up with 5V.

I find UCGLIB slower and more memory intensive than the Adafruit librar, but both work. I only use the HW SPI.





CircuitGuru
http://www.circuitguru.co.uk/

Ironic62

Thanks all for answers.


I try to replace CD4050 by resistors like this:




Everything works as with CD4050 but now :
- Ucglib works with HWSPI (10 times faster).
- Adafruit_ILI9341 doesn't work, White screen again.
- UTFT always slow (SWSPI).

Very strange, Ucglib works and not Adafruit9341 !!
I would like to use Adafruit ou Ucglib so now i can.

But i want to know WHY Hardware SPI doesn't work with Adadruit (last release).
- I think CD4050 was probably bad but.... not sure.
- Wires are good, 3 libraries work in HW SPI very fast, no bug.
- 5V Arduino is USB power, 3.3V is LM317+caps

Ucglib works so i will try it.







JMe87

Hi Ironic62,
did you modify some #define values to match your wiring in Adafruit demo code ?

my modifications :

#define _cs 5   //  10
#define _dc 6   //  9
#define _rst 4   //  8

Jacques

Ironic62

Hi

I think Adafruit works like :


To use Software SPI, set :
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

For me is :
Adafruit_ILI9341 tft = Adafruit_ILI9341(5, 6, 11, 13, 4, 12);
- This works but very slow.



To use Hardware SPI, set :
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);

#define TFT_DC 6
#define TFT_CS 5
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);    or    Adafruit_ILI9341 tft = Adafruit_ILI9341(5,6);
- This doesn't work, i get a white screen.



Since few hours i use Ucglib (HWSPI )and i like this lib.

I want to know who use what lib and why ?

UTFT is ONLY Sorfware SPI, so very slow, is it true ?




JMe87

Hi
i used graphictest.ino, democ ode in Adafruit library

first line of the code i use :

Code: [Select]
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9340.h"

#define _sclk 13
#define _miso 12
#define _mosi 11
#define _cs 5 //10
#define _dc 6 //9
#define _rst 4 //8

Adafruit_ILI9340 tft = Adafruit_ILI9340(_cs, _dc, _rst);  // Use hardware SPI


fast and work perfectly
Jacques

Ironic62

#130
Jun 10, 2014, 02:04 am Last Edit: Jun 10, 2014, 02:08 am by Ironic62 Reason: 1
I open "graphicstest.ino" from Adafruit_9341 and i see :

Quote
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

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

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);


No "TFT_RST" ... strange...

I paste your code in my sketch but i replace ILI9340 by ILI9341

AND...

IT WORKS !!! as fast as others HWSPI Libraries.

Thanks a lot, why i don't try this before  :0

Nice to have Adafruit library running fast now.



casemod

In most cases reset is a waste of a pin. Just wire it to 3.3V or to the arduino reset with a resistor.
If the display has an internal pull up you can leave it unconected.
CircuitGuru
http://www.circuitguru.co.uk/

Ironic62

Just a last question.

For driving this screen, 6 wires are needed.
- sclk - miso - mosi - cs - dc - rst

[sclk] is needed and must be pin 13 for Hardware SPI.
[miso] is unneeded and can be unwire disconnect. (communication TFT => Arduino)
[mosi] is needed and must be pin 11 for Hardware SPI.
[cs] is needed and can be any other output pin.
[dc] is needed and can be any other output pin.
[rst] is unneeded and can be wired to 3.3v or arduino reset with a resistor.

So Can i use Hardware SPI and use pin 12 for [cs] or [dc].

I try it but not working.



casemod


Just a last question.

For driving this screen, 6 wires are needed.
- sclk - miso - mosi - cs - dc - rst

[sclk] is needed and must be pin 13 for Hardware SPI.
[miso] is unneeded and can be unwire disconnect. (communication TFT => Arduino)
[mosi] is needed and must be pin 11 for Hardware SPI.
[cs] is needed and can be any other output pin.
[dc] is needed and can be any other output pin.
[rst] is unneeded and can be wired to 3.3v or arduino reset with a resistor.

So Can i use Hardware SPI and use pin 12 for [cs] or [dc].

I try it but not working.



No. You cant define two functions to a single PIN. Either you set it to HWSPI or to Digital Output.
Assuming you are not using the TFT you could ground the CS Pin to save a digital I/O. You have to change the library tough, otherwise it will give you an error if you dont define it.
CircuitGuru
http://www.circuitguru.co.uk/

olikraus

Quote
No. You cant define two functions to a single PIN. Either you set it to HWSPI or to Digital Output.

Correct, it is a hardware restriction of the ATMega controller.

Quote
Assuming you are not using the TFT you could ground the CS Pin to save a digital I/O. You have to change the library tough, otherwise it will give you an error if you dont define it.

The falling edge of the CS signal will also reset the communication unit on the TFT controller. Without CS it might get out of sync more easier. In fact it might not work at all.

Oliver

Go Up