Behavior of ILI9341 display with and without an SD card.

Hello,

I have a 2.4" TFT SPI display with the SD card slot attached on the back. Like this one:

I use the library TFT_v2.0 from this topic:
https://forum.arduino.cc/index.php?topic=181679.0

I use a Mega 2560 and a 4050 IC with the display.

I got it working great without the SD card implemented (no wiring, no code or library).
I decided to try and add the SD feature. The pins are shared between the display and SD card. First I tried wiring it through the 4050 but it did not work. I tried wiring it directly at the pins and it's working great.

My problem is that if I remove the SD card the display becomes really slow. It takes 10-15 seconds to refresh the screen. If I want to use the display without the SD card I have to remove the things related to the SD feature.

So I want to have the SD card capability but I do not want to always have an SD card plugged in. Is there a way I can trick the Arduino to think that an SD card is always inserted (even if it's not)? Or any other way to fix this problem.

Post your schematic. A pencil drawing is fine. Post a photo.

These Red displays work fine with proper 3.3V GPIO.
e.g. ILI9341, XPT2046, SD all on the same hardware SPI bus.

These Red displays should work with Uno / Mega 5V GPIO providing you use level shifters.

Note that CS, DC, RST, ... control signals must be 3.3V logic.

David.

Edit. You appear to have found the Seeed V2 shield. There are links to V2 library, manual, V2 schematic, ...
Print out the schematic. Follow their scheme regarding TFT and SD. You can use different level-shifter chips but make sure that you compare each datasheet.

Hey,
I use the same display but the 2.2 inch version (no touch). This is my schematic. Is this the right way?

These Red displays work fine with proper 3.3V GPIO.
e.g. ILI9341, XPT2046, SD all on the same hardware SPI bus.

This would be my fifth attempt. :confused:

Best regards
Willy

Your schematic has lots of items called R? and a header called J?

And some random names with random numbers e.g. TFT_CLK 52

Surely it is worth identifying components unambiguously.

The pins on the Red ILI9341 board have got labels that correspond to J2 and J3.

A MEGA2560 has got a 18x2 DIGITAL header with 5V, GND and digital 22-53.
J? does not correspond to anything on an Arduino MEGA2560.

David.

Thanks for your answer, but i don't understand something.

J1 is a connector to Arduino MEGA2560
J2 Display
j3 SD card slot

Sorry TFT_CLK means SCK from the TFT.

LG Willy

Thanks for the updated schematic.
You still have some random text e.g. TFT_MISO 5

Remove R15. It is unnecessary.
You could connect MISO on J2 to SD_MISO on J3.

If you are using Adafruit_ILI9341 library, you need a constructor e.g.

//Adafruit_ILI9341 tft(TFT_CS, TFT_DC, TFT_RST);
Adafruit_ILI9341 tft(49, 47, 48);

David.

Thanks, i will change this.
The most important thing for me is that SD and TFT use the SAME HW SPI.
I use ADAFRUIT_ili9341 Lib with this constructor.
By the way, I ordered 2 4 channel level shifters.

Have a nice weekend.

KUCKY:
Thanks, i will change this.
The most important thing for me is that SD and TFT use the SAME HW SPI.
I use ADAFRUIT_ili9341 Lib with this constructor.
By the way, I ordered 2 4 channel level shifters.

[You still have some random text e.g. TFT_MISO 5"0"]

One question. Can i use the standard SD Lib? I just want a bitmap as splash screen. It is a part of my RC project.

Have a nice weekend.

The most important thing for me is that SD and TFT use the SAME HW SPI.

Very sensible. I always put TFT, Touch and SD on the same SPI bus.

I use ADAFRUIT_ili9341 Lib with this constructor.

Show us your physical wiring. Show us your constructor.

By the way, I ordered 2 4 channel level shifters.

very wise. However your resistor potential dividers should work 100%.

One question. Can i use the standard SD Lib? I just want a bitmap as splash screen. It is a part of my RC project.

Yes, you can use SD.h because you are using the HW SPI bus i.e. 50-52.

Seriously. You seem to be struggling with your Red ILI9341 SPI board. It should be very easy. Many readers use the 3.3V Red SPI boards with Uno, Mega, ... They must use level shifters of some description e.g. series resistors, potential dividers, integrated circuits, ...

David.

:confused:
It is many ILI9341 Versionen in the web, (e.g Adafruit_GFX_AS ...) . Now i will use the original ADAFRUIT Lib.

This is my Conctructor now:
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);

and the standart HW SPI Pins (Mega2560)

I review my physical wiring.

Stupid question. Are there special 3.3V SD cards? I use a 128MB card from Canon out of my camera.

Thanks in advance, I'll get in touch.

Stupid question. Are there special 3.3V SD cards?

All SD cards are 3.3V (power and logic signals).

The Red boards have a AMS1117 3.3V regulator. You connect VCC pin to 5V. The regulator ensures that the SD card gets 3.3V power.

Your potential dividers ensure that the SD gets 3.3V logic signals from the Mega's 5V GPIO.

Your schematics are helpful but we really need to see the actual wiring.

Does your TFT work 100% with Adafruit_ILI9341 examples?
Does the SD work 100% with SD.h examples? (make sure that TFT_CS is deselected i.e. logic high)

David.

Hey, the Display works fine with my compass code.

Connect to serial port COM16 at 9600

Initializing SD card...Wiring is correct and a card is present.

Card type: SD1
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card
I willl format this.

I have changed the sd card. 1GB Hama. I do not use a level shifter for tis example.

Willy

FAD32 format

Initializing SD card...Wiring is correct and a card is present.

Card type: SD1
Clusters: 247392
Blocks x Cluster: 8
Total Blocks: 1979136

Volume type is: FAT32
Volume size (Kb): 989568
Volume size (Mb): 966
Volume size (Gb): 0.94

Files found on the card (name, date and size in bytes):
SYSTEM~1/ 2019-09-14 18:43:02
SOFTSPI.TXT 2019-09-01 20:41:06 0
GATORS.BMP 2019-04-30 18:42:58 460856
MINIWOOF.BMP 2019-04-30 18:42:58 57654
WALES.BMP 2019-04-30 18:42:58 8420
WOOF.BMP 2019-04-30 18:42:58 230456
PARROT.BMP 2018-11-20 15:45:34 61496
PURPLE.BMP 2018-11-20 15:45:34 230456

Assuming your schematic from #4 with my mod from #5.

Does your TFT work 100% with Adafruit_ILI9341 examples?
Does the SD work 100% with SD.h examples? (make sure that TFT_CS is deselected i.e. logic high)

WE are in different countries.
Please describe your w
schematic, wiring, library example, ...

The SD card expects 3.3V power and 3.3V logic signals.
Yes, most SD cards seem to be input voltage tolerant for the logic.
You MUST supply 3.3V to the SD but 5V logic signals "work".

There is no guarantee that all SD cards will be tolerant. It is not wise to use 5V logic.

David.

You can see, the second output SD card info is correct (My last reply). Now i wait for the level shifters.

Willy

We can conclude that your TFT is working 100% and the SD is working 100%.

You should be able to display .BMP images from the SD card or any other sketches.

David.

Yes. i think so too. I wait for my order, and do a new physical wiring.

Willy

Your current "wiring" is 100%. There is no reason to wait.

You should be able to run all of Bodmer's TFT_ILI9341 examples.
e.g. display .BMP from SD
e.g. display .JPG from SD
e.g. display .JPG from mega2560 PROGMEM
e.g. different fonts
...

Many of Bodmer's TFT_eSPI examples will compile on your Mega2560.

David.

Hello David,
I didn´t forget you. I ordered the level shifter in Germany, but they have not arrived yet. I'll get back.

Willy

In the UK there are lots of Ebay shops that say "UK Warehouse" but actually they get stock from China via regular "just in time" deliveries.

A genuine shop with genuine UK stock will advertise 48-72 hour delivery.
A "just in time" shop will advertise 7-8 day delivery.

Of course the "just in time" shops will probably have some popular items on real UK shelves.
I have sometimes received "8 day" items in 48 hours.

Mind you, regular Chinese shops might advertise 28 day delivery and it arrives sooner.

My point in #17 was that your existing potential divider scheme should work 100%

David.