A Uno shield will plug into any Arduino e.g. Uno, Leo, Mega, Zero, ... as well as many other boards.
Yes, you can re-wire the data pins to use digital 22-29 on a Mega. And re-wire 11-13 to 50-52 for hardware SPI.
I use a Protoshield. But it is not as neat as buying a proper Mega Display Shield in the first place.
Yes, you can access non-shield pins by using angle-header strip. Or mount extra electronics on the Protoshield.
Thank you for your swift reply, thatās brilliant news.
Iām learning as I go, this one seems pretty tough.
Considering more or less the most Iāve done re display libs is change ID to myscreenID and configured the touch within my sketches,
Im not sure where to start
Am I going down the route of define mega Proto and then something else or actually writing code for port and pin out?
Just to reiterate my main reason for this is to get it fast like it is on the UNO and I understand that ports make the difference?
If I find an equivalent that is intended for the mega I will certainly look at getting it, so far no joy.
Please correct me if Iām wrong?
Matt
Edit; the picture above looks like the pinout I want?!?
You have a Mega Shield with 8-bit parallel data bus, XPT2046 Touch Controller, microSD card.
TFT: define USE_SPECIAL, USE_MEGA_8BIT_SHIELD
Touch: use URTouch.h library
SD card: SD_CS=53. Use regular <SD.h> library. (It might be unreliable because the Resistor Pack has a high value)
It is not possible to read the controller ID.
If it has an ILI9488 controller (0x9488) graphictest_kbv should work 100% except for ID and SOFTWARE SCROLL.
Run the example āTouchScreen_Calibr_nativeā from mcu lib.
Save the serial output
Next open button_simple example sketch and paste the results in place of the dummy ones ie const int XP = 6, XM = A2 etc etc
Then run it
If not try diagnose_touchpins.
Hope that helps...
In the end simple button is your example of more than one library used in a sketch.
Mr P, in relation to my project I donāt really know how. Yours is the only library that Iāve had any success with in getting the screen to operate, so Iām starting here.
So far I have added cables to prove all connections are good and allow for testing different pin configs but anything other than the vanilla arrangement and the screen does not work so far.
As stated before aim is to improve performance over stock uno shield on mega2560.
I intended to put together a custom header board once it works on the bench.
Please may I have some baby step guidance.
Many thanks,
Matt
You say that you have bought a Uno shield. It should run out of the box on your Mega. (but will be SLOWER than a Uno)
Run all the MCUFRIEND_kbv examples.
Quote which example has a problem. (just quote the example name)
It is much easier to buy a ready-made Mega Shield than to re-route Uno Shield via a Protoshield.
Doing anything with trailing wires is a recipe for disaster.
But I don't know how to join the 2 libraries, is there no example to make it work?
URTouch is written by Henning Karlsen (the author of UTFT). You should install URTouch from his website
Your shield has a XPT2046 Touch Controller on pins 2-6.
URTouch examples can be "run" fairly easily with UTFTGLUE:
edit MCUFRIEND_kbv library for USE_SERIAL, USE_MEGA_8BIT_SHIELD
edit UTFTGLUE.h for your controller ID e.g.
if (ID == 0xD3D3) ID = 0x9488; //write-only controller
run GLUE_Demo_480x320.ino to verify your edit
3. load URTouch_Calibration.ino from URTouch Examples
4. edit UTFT -> UTFTGLUE and comment the font statement e.g.
#include <UTFTGLUE.h> //change from UTFT.h
#include <URTouch.h>
...
// Remember to change the model parameter to suit your display module!
UTFTGLUE myGLCD(0x9488,38,39,40,41); //change from UTFT
// Initialize touchscreen
// ----------------------
// Set the pins to the correct ones for your development board
...
URTouch myTouch( 6, 5, 4, 3, 2); //these should be correct for your shield
...
// Declare which fonts we will be using
//extern uint8_t SmallFont[]; //comment this line
...
Run URTouch_Calibration. Follow instructions
Load URTouch_QuickDraw. Edit UTFT to UTFTGLUE as in (4)
Add a setColor() statement. e.g.
void setup()
{
myGLCD.InitLCD();
myGLCD.clrScr();
myGLCD.setColor(0x001F); // any visible colour. (default was BLACK)
myTouch.InitTouch();
myTouch.setPrecision(PREC_MEDIUM);
}
Run URTouch_QuickDraw.
Load URTouch_QuickPaint. Edit UTFT to UTFTGLUE as in (4)
Run URTouch_QuickPaint
Yes, I know that this is fiddly. But you do have a non-Uno shield. When you have changed a library example save the working sketch in your sketch folder for future reference.
Ask if you have a problem. Quote the step number.
When you have the (edited) URTouch examples working, I will post the URTouch version of "button_simple.ino"
Thanks David,
I did include an ESSAY on why a few posts ago, donāt read it unless you have hot tea.
Everything works out of the box thanks to your libraries, itās incredible really so thank you very much for that!
I chopped a tiny bit of my program code to fit on an uno and tested it all with only 2 data inputs and the difference is astonishing, I cannot demo my project until I have it running like that on the mega, ideally with rewritten pins/ports as UNO shields are available everywhere very cheap and even previously I ordered for Mega not Uno and still got Uno
Off the bench and in my project enclosure the screen and Arduino may not be mated together anyway,
Iāve been working to find an equivalent shield for Mega (3.2 320x480 with touch, sd or no sd is ok) but not much joy, closest Iāve got is what I hope will arrive as a 16bit mega shield without touch.... I also ordered a touch panel with controller...
Those will be with me in 100 years thanks to Covid-19.
Otherwise it seems like my only option is to understand libraries.
There are Mega shields with Touch e.g. photo in #2943
Most have 16-bit interface. (7 resistor packs next to 18x2 header)
Most 3.5inch screens are bigger than a mega2560. So the screen is going to take up most of any enclosure front panel. If you re-route signals via a ProtoShield Adapter you just get a deeper sandwich.
I also ordered a touch panel with controller...
A bare Touch panel is very difficult for you to stick to the screen.
A Mega will still have plenty of spare pins even with a shield in place.
Edit: I attempted to attach pics of what I ordered and what I have but the forum doesnāt like it, will try from pc later...
I will hunt for something with touch already on there too now and in the mean time I will continue to try and learn whatās actually going on driver/pin/port assignment wise.
If this project is successful and I somehow get as far as a production model I hope Iāll be able to just spec/order one type of screen and hopefully let experts optimise etc... all will be good but if I wind up making these ad-hoc it would be nice to be flexible on what screen I use...due to cost/avaliability etc. 2.8 touch seems easy to find for mega but really is too small for my application and less than 480 pixels is troublesome because 480 points gives me ~3 seconds worth of data which is exactly what I need to display.
One question, so Iām not chasing geese,
Do the pin/ port assignments all happen inside the mcufriend lib or does some/all happen in the GFX lib? I came across reference to secondary data pins/ports ie 22-29 within the GFX lib which made me realise I donāt know the answer to that question.
I've been playing with the library for some time with great success (David even included my timings for Teensy in v 2.9.9 beta) Now I encountered a challenge. Not critical but would greatly improve my design if it worked.
Unless I'm wrong, from what I see and understand about the vertScroll method it only works for entire screen.
I'm using the display in horizontal mode and need to scroll an area/window horizontally, which should still follow the hardware direction. I've tried the software method already. What I'm looking here is just confirmation that it's not possible to hardware scroll a defined area of the screen.