[SOLVED] Shield TFT ILI9341 very slower on MEGA!

Hello,
I tested some samples of mcufriend on MEGA (no SD card used) and compared to the UNO, it's up 3,5 times slower! Is there a workaround?

It seems it also depends of the firmware, I tried HX8347 on MEGA, it is about 1,5 times slower... so 5 times slower than the ILI9341 on UNO!

Yes, of course the Mega2560 will be much slower when it is running a UNO shield. e.g. tractor pushColors() is 149ms vs 60ms

If you want to go fast on a MEGA2560 buy a Mega2560 shield. (which will not fit on a Uno)

It comes down to the data bus on Uno shields. LCD_D0-LCD_D7 are sensible pins on PORTB, PORTD for a Uno. Random pins on a Mega.

And HX8347 is always going to be slower than either ILI9320 or ILI9341 style controllers.

David.

Edit. The purpose of this example is to demonstrate the Adafruit_GFX methods
e.g. drawing monochrome images with different foreground colour and background.
e.g. drawing RGB images
e.g. with masks

The Adafruit_GFX methods simply draw individual pixels. Hence the flexibility but slowness.
The pushColors() examples use the hardware to display solid rectangular images.

Thanks for you answer.

  1. Is it the Mega2560 shield you spoke?

  1. I have to connect both the TFT Shield and the MEGA2560 board on the Mega2560 shield?

  1. Why I could not connect directly the TFT on the MEGA by using wires instead of stacking them?

(1) is a ProtoShield. Solder an 18x2 female header. You can re-route the data bus to D22-D29 on the 2x18. Cut the copper traces from the original data bus.

There is a SPECIAL for this. It will work FASTER than the Uno. i.e. USE_MEGA_8BIT_PROTOSHIELD

There are several ready-made Display Shields for the Mega2560. Most use a 16-bit bus. There is a SPECIAL for 16-bit Shields. i.e. USE_MEGA_16BIT_SHIELD

Your Uno Display Shield is read-write and continues to be read-write with the Protoshield.

The Mega Display Shields are always write-only.

David.

Not sure to understand all the procedure but, I need to buy so I googled to buy a ready-made 16-bits bus Display Shields for the Mega2560 but I did'nt find no one :frowning:

Search for "320x480 Mega2560 Touch" on Ebay, ...

e.g. like this
or this

Note that a Mega Shield has 18x2 header that mates with MEGA2560.

Displays with 16x2, 17x2, 20x2 headers all require Adapters with level shifters.

David.

Ah ok, there's a misunderstood, I thought you spoke about a special shield, a sort of adaptor for my case. Although, I didn't know there're other kind of TFT with 18x2 headers specially adapted for the Mega. It's interesting, thanks! I order one that I will test.
But for now, I still would like to make work this screen on the Mega because all my codes are for that resolution (320x240) and this specific size of the screen.

So I connected the screen on the Mega with Dupond wires:

LCD_D0 -> D22
LCD_D1 -> D23
LCD_D2 -> D24
LCD_D3 -> D25
LCD_D4 -> D26
LCD_D5 -> D27
LCD_D6 -> D28
LCD_D7 -> D29

Here's I kept the UNO pinout:
LCD_RD -> A0
LCD_WR -> A1
LCD_RS -> A2
LCD_CS -> A3
LCD_RST -> A4

I uncommented SPECIAL in "mcufriend_shied.h", then I uncommented one after the other in "mcufriend_special.h":
USE_MEGA_8BIT_PROTOSHIELD
USE_MEGA_8BIT_SHIELD
USE_MEGA_8BIT_PORTC_SHIELD

=> WHITE SCREEN

Now I changed this part of the wiring:

LCD_RD -> A0 (I didn't change it, I don't know where else)
LCD_WR -> 39
LCD_RS -> 38
LCD_CS -> 40
LCD_RST -> 41

Then I tried again to uncomment the previous USE_MEGA_8BIT_ but I still have a white screen.
I don't know what I could try else.

So I connected the screen on the Mega with Dupont wires:

LCD_D0 -> D22
LCD_D1 -> D23
LCD_D2 -> D24
LCD_D3 -> D25
LCD_D4 -> D26
LCD_D5 -> D27
LCD_D6 -> D28
LCD_D7 -> D29

Here's I kept the UNO pinout:
LCD_RD -> A0
LCD_WR -> A1
LCD_RS -> A2
LCD_CS -> A3
LCD_RST -> A4

I uncommented #define USE_SPECIAL in "mcufriend_shield.h", then I uncommented only one after the other in "mcufriend_special.h":
#define USE_MEGA_8BIT_PROTOSHIELD

is correct. Obviously your Dupont wires should be good. And you should connect 3.3V, 5V, GND pins.

Personally, I would only be happy with a soldered ProtoShield.

Hey-ho. YMMV.

David.

Wow! It works, I had inverted two bus wires (Do with D1) ! The sample test shows that it’s slightly faster than the UNO now!

I have a last problem, there’s no touch anymore. I tried the “TouchScreen_Calibr_native” sketch and I get the message “Broken touchscreen”. The same error with a second screen to check.
I always used the following on UNO:

#include <TouchScreen.h>

#define YP A3
#define XM A2
#define YM 9
#define XP 8

MCUFRIEND_kbv tft;
TouchScreen ts=TouchScreen(XP,YP,XM,YM,364);

I need to change these constants by which values?

I strongly recommend using const assignments like my examples.
YM = 23
XP = 22

You could edit the Calibration sketch to search 22-29 as well as 2-9

Great! Your values work on MEGA, no need calibration. I just noticed I need to add a small pressure or reduce the r value, about 300 instead of 364 to have the same feeling.

Thank you very much!