Go Down

Topic: 320 x 480 TFT ILI9481 Slow on MEGA (Read 1 time) previous topic - next topic

heinburgh

Hello forum,

This is my first go with TFT shield displays, a step away from the 2 x 16 LCD's I'm used to. I bought two of these displays on EBAY (https://www.ebay.co.uk/itm/3-5inch-TFT-Color-Screen-Module-320X480-Ultra-HD-LCD-Shield-for-Arduino-UNO-FT/112790945520?hash=item1a42dd3ef0:m:miQ_f6oi8m3Qb6KK72-o1Mg)

It is advertised for use with UNO's, and it works great on them, but I slapped the TFT shield onto a MEGA and it works without having to alter the code. Only problem is that is performs at about 60% of the speed on a MEGA compared to on an UNO.

I would have thought this would be the other way around. Does anyone know the reason for this? Is there something I can adjust in the wiring or code to get this display as snappy as on the UNO?

Thanks,
Hein

david_prentice

These Shields are designed for a Uno.   They work at a pretty good speed on a Uno.

Yes,  it will work on a Mega (and Zero, Due, Leonardo, Nucleo, ...) but SLOWER.
This is because it is mapped to sensible pins for a Uno but these are random Port pins on the other targets.

If you want to run a display on a Mega,  buy a Shield that is designed for the Mega.
Or hand-wire an Adapter with a Protoshield.

MCUFRIEND_kbv has always had USE_MEGA_8BIT_PROTOSHIELD in its SPECIALs
Yes,   the Mega will work FASTER than the Uno with USE_MEGA_8BIT_PROTOSHIELD

Incidentally,   my Blue ILI9481 Shield gets quite hot to the touch.   

David.

Grumpy_Mike

Quote
I would have thought this would be the other way around.
No they should be the same.

I suspect that the libiary checks to see if the SPI pins are on the same pins as the Uno uses and when it finds a MEGA, it knows it can not work with the hardware SPI because these are on different pins and so resorts to bit banging the SPI protocol.

To change this so that it works on the MEGA at the same speed as the Uno then you have to rewire the module so it uses the pins that the MEGA has for SPI and alter the libiary so that it does not change the way it drives these pins.

Just a guess but I would be surprised if I was wrong.

david_prentice

#3
Jun 03, 2018, 02:22 pm Last Edit: Jun 03, 2018, 02:23 pm by david_prentice
You will be surprised !!!

David.

heinburgh

The project I'm working on will have the display embedded in a hinged door, with the mega inside the enclosure with a ribbon connecting the two. I want to do this to keep the inside of the door as flat as possible, so I don't want the mega cluttering up that space.

So I will be connecting the two with leads anyway. If I was to connect the TFT to the right ports on the mega, how complicated would it be to change the coding for it to work at top speed?

We're based in Africa - getting a protoshield here is going to take another two weeks, cannot wait that long.

heinburgh

Would one of these be of any use?

david_prentice

Shields are one of the best features of Arduino.    Standardised software and standardised hardware.

I would never advise random jumper leads.    Well made ribbon cables are better.
If you wire it carefully it would be electrically the same as a Protoshield Adapter e.g.  USE_SPECIAL and USE_MEGA_8BIT_PROTOSHIELD.

Make sure that you connect to 3.3V, 5V,  GND.

David.

heinburgh

Would one of these be of any use in connecting the two, or do we only need straight connections?

david_prentice

That Adapter is for 40-pin 3.3V displays.

Your Shield just needs straight wires e.g. LCD_D0 - LCD_D7 go to D22 - D29 on the Mega,
LCD_RD . LCD_RST go to A0 - A4 on the Mega.   GND to GND.  3.3V to 3.3V.  5V to 5V.

David.

heinburgh

Thanks David for taking the time.

I uncommented "USE_MEGA_8BIT_PROTOSHIELD" in mcufriend_special.h. Is there code I need to add to my sketch to complete this?

heinburgh

GOt it!

I missed #define USE_SPECIAL .

Thanks David!!

heinburgh

You may have anticipated this newbie's next question...

When I had the shield stuck directly onto the MEGA I had the SD reader working by bending out the four SD pins and wiring them to D50 (SD_00),  51 (SD_01), 52 (SD_SCK) and SD_SS going to GND. Worked beautifully.

Now that I've connected the shield as per your instructions the screen updates like a wildfire but SD won't initialise.

What do I need to change on this wiring to get it going again?

Many thanks,
Hein

david_prentice

#12
Jun 03, 2018, 08:39 pm Last Edit: Jun 03, 2018, 08:40 pm by david_prentice
You either re-route the microSD SPI pins (D11-D13) to D50-D52 e.g. showBMP_kbv_Uno
Or you use software SPI on D11-D13 e.g. showBMP_not_Uno

Software SPI involves using a third party SD library.  Instructions in showBMP_not_Uno

David.

heinburgh

What happens with SD_SS? GND, 53 or 10?

Grumpy_Mike

#14
Jun 03, 2018, 10:23 pm Last Edit: Jun 03, 2018, 10:24 pm by Grumpy_Mike
You will be surprised !!!

David.
OK care to enlighten me, and others, or is it a secret?

To me everything you have said so far seems to align with my guess.

Go Up