Problem porting 3.5" tft from uno to mega

I am using the MCUFRIEND TFT display ID=6814(ili9846) controller for a project. I developed the firmware on an UNO and everything works fine including the touchscreen and SD card.

Needing more program memory, I am trying to use the display with a Mega Mini2560 board. Every thing works but the display is running at less than half the speed of the UNO and the backlight flickers and dims when the board is talking to the display. Depending on the last byte written to the display it remains either dim or bright.

I have looked at every display pin with a scope and can find nothing amiss. I have two Mega boards and two displays. The problem is consistent for all combinations.

I ran the AdaFruit graphics test example and it works fine but takes nearly 2.5 times longer to complete.
I have read that the way the ports of the Mega are mapped to the digital pins requires extra bit manipulations to occur and that causes a slowdown but I cannot explain the backlight flicker.

I am hoping that someone has solved this problem before and can clue me in.

What is a Mega Mini 2560?

The shields plug into a regular Mega2560 as Nature intended.
The backlight is powered via the 5V pin. There is no way to control the brightness.

99% of Mcufriend shields use 74HC245 buffers instead of the input tolerant VHC or LV versions.
The shields seem to work ok when powered by USB.

If you want a TFT to run at a sensible speed on a Mega, buy a Mega2560 shield i.e. that uses digital #22-29.


This is the processor in question:

The backlight is the main problem. I tried connecting only +5V and GND. The backlight does not light. There is more to it with this display evidently.

Yes, you are correct. The display incorporates '245s and works just fine with an UNO powered by USB.

Life is a mystery. Why buy a shield if your "Arduino" does not have female sockets to receive it?
A Mega is almost the same size as your 3.5 inch screen. You gain nothing with a "smaller" pcb especially since any hand-wiring is going to be less tidy than a naturally mated shield.

The original Mcufriend Uno Shields have an AMS1117 on the pcb which supplies the backlight with 3.3V.
The new RM68140 Shield on my desk does not have an AMS1117. So I presume the backlight has a "bigger value" series resistor to cope with 5V. Yes, my screen gets very warm to the touch. Which implies that the backlight should really have an even bigger resistor. (it will be out of view on the flexi-ribbon)

There is a big difference between 245, HC245, VHC245, ...

I would test your program with a proper Mega2560. If you are hand-wiring your Ebay board, you might just as well use the USE_MEGA_8BIT_PROTOSHIELD wiring as a SPECIAL


Actually the Mega is only one module on the circuit board that I have designed. So no hand wiring will be required.

Yes, you're right, I slipped up. I should have included the HC in front of the 245.

Unfortunately I was unaware of the port mapping problem with the Mega. Looks like I will need some cuts and jumpers to connect to a contiguous port. Reading thru some other topics on this port problem I guess that I will need to modify the .h file of the library to do this.

I still can't figure out what the backlight intensity problem might be caused by. Very strange. It works perfectly on the UNO.

The displays I have are equipped with an unpopulated 8 pin SOIC pattern on the back so I guess that I am one of the "lucky" ones that received the New model. I would have liked the series resistor much better.

No, you never see the series resistor even with the AMS1117.

The empty footprint is for a Flash memory chip which steals the microSD pins.
Flash memory chips are NEVER input voltage tolerant. MicroSD does seem to survive 5V GPIO.

No-one ever claimed that Mcufriend shields were properly designed. Their main virtue is that they are cheap and they "plug-in".


Yes, you're right. You get what you pay for (or less).

As I will need to redesign the PCB in any event, do you know of a better display that has the same basic specs? ( i.e. 320x480 resolution, SD card socket and a touch screen)

hola estoy haciendo un proyecto con una pantalla tft 3.95" táctil y he tenido muchos problemas con las librerias
no me muestra lo que hago en la pantalla completa solo en una parte alguien por favor me podria indicar que hacer para que salga en toda la pantalla. gracias

Found the problem with the dimming display!

A hairline void in the 3.3 V line to the display. Apparently leakage from the 5 V GPIO lines was enough to allow the display to work, but it screwed up whatever is controlling the backlight LED operation. Bypassing the trace defect resulted in normal operation. The dependency on the last byte written to the display was the high sign. :slight_smile: