ST7735R LCD shield w/ SDcage - not working on Mega 2560?

Hi all,

few weeks I have sold my Arduino Uno and bought a Mega 2560 instead (my projects were growing up and there were not enough digital pins for me :slight_smile: :slight_smile: ). Now I am getting first experiences with Mega and its capabilities/differences compared to Uno.

I have bought an colour SPI 1,8" LCD shield (using ST7735R controller) with keypad buttons.
Here is a link:
Even I got it working with Adafruit LCD library after few tweaks.
Nice piece of hardware. There is also a microSD card reader onboard, and thats why I have bought it.

BUT :roll_eyes: If I use his demo code (ready to download on item page) it simply doesnt work. Says that init of SD card failed.
When I gathered informations about SD card pins, found out that there are different connections on Mega boards (compared to Uno boards). Also found that on some these lcd shields sellers are noticing that on Mega`s SD doesnt work....

Also tried simple SD card example from Arduino IDE, with no luck...

Any ideas what to try next / or where could be problem ? I want to write him that this shield is not fully Mega compatible, but want to ensure that I am not doing anything bad....


The SDCard will use SPI, usually pins 11,12,13 and 4 on Uno.

On the Mega2560 SPI is no longer on those pins, but on 50 somthing (Might be 50,51,52), so the shield won't connect the correct pins through.

Mega compatible SPI shield, such as Ethernet, make use of the 6 Pin ISP header as that also has the SPI pins present so is a common SPI pining across both Arduino's.

If you want to use your device then you'll need to connect the relevant device pins to the correct alternatives on the Mega2560.

Thanks for reply !

I thought about this problem - both devices (LCD and SD) uses SPI and it need slave select (SS) which is on pin 55 on mega.
So my ideas of what causes SD not working were correct...

I just wanted to ensure about it - thank you.

If the LCD uses SPI too then both devices will share the MOSI, MISO and SCK pins but then have a SS pin each. Hardware SS is usually pin 10, so that is probably your pin 54 equivalent on Mega.

SD Card tends to be pin 4 for SS.

Note that you can often configure the SS pins in the libraries though, so you could check if they state D10 and D4 and leave them as is. You’d just need to get the 3 SPI pins to the correct Mega ones then.

Yes, you are completely right Unfortunately the modding the libs can be only possible if desired pins are not required by other devices which is sadly my case... But probably I will sell this shield and buy another display module.
But spotted that ST7735 is slow for my needs - posted a question in newly posted thread by another user - it has suitable topic name for my question :wink:

Thank you for your time !

What library are you using for the display? Check in the library and see what the SPI clock divider is.

SPI can work up to half the MCU clock speed, so you can sometimes get a speed increase by changing the divider in the library from something like 8 or 4 to 2.


display in standart demo code uses these libraries:
<Adafruit_GFX.h> // Core graphics library
<Adafruit_ST7735.h> // Hardware-specific library

Will look on SPI clock later. As I understand it could run at 8 Mhz max (or in double divided freqs)?

But might found an answer why the lcd is slow on Mega - found this video:

Its test of the same LCD (but in non shield version) running the demo code on Leonardo (? - not sure it it is Leonardo ;)) As in this comparison the LCD in SPI works much faster than in “simple connection” (?GPIO). Mine display shield is behaving same slow, as on “simple connection”. Ran the exactly same code as in video.
Could it mean, that if I use other pins than SPI marked on Mega that it causes the slow because general digital pins has slower data output rates than serial marked ones?

(code example uses : cs 10 //LCD Chipselect; dc 9 //LCD Data or Command; sclk 13 //Hardware SPI SCLK; mosi 11 //Hardware SPI MOSI)

Thanks for ideas :slight_smile:

SPI isn't on 11,12,13 on Mega2560

They are just normal pins, that's why there is no difference in speed.

The SPI on Mega2560 is on 50,51,52 and the ICSP header. 53 is hardware SS.

SPI isn't on 11,12,13 on Mega2560

They are just normal pins, that's why there is no difference in speed.

The SPI on Mega2560 is on 50,51,52 and the ICSP header. 53 is hardware SS.

Sorry, but didnt you thought that there IS a difference in speed?

And I am using these pins on Mega with sample code and it "works" , but there is described slowness in speed of redrawing... Might these be solved with soldering a wires and reconnect it on above pins you spoke about?

There IS a difference in speed betwene SPI and normal pins.

What I am saying is that if you connect to 11,12,13 on the Mega2560 then they ARE normal pins.

On the Uno, 11,12,13 are the hardware SPI pins
On the Mega2560, 11,12,13 are NOT the hardware SPI pins

Therefore, when you connect to 11,12,13 on Mega2560 the speed won't be any different than if you use, say, 3,4,5 on the Mega2560.

Using 11,12,13 on the Uno will be a lot faster than using 3,4,5 on the Uno.

To get the hardware SPI speed on the Mega2560, you need to connect to it's hardware SPI pins (50,51,52) OR through the relevant MOSI, MISO, SCK pins on the ICSP header (4,1,3 respectively)

Oh, right it is definitely the thing i thought of...

I maybe wrote in not so good to understand english. I am not a native speaker, sorry about that.

So now I know that for use on Mega I have to do a wirings and that I cant use this shield as a shield (directly plugged on mega) but have to wire it to equivalent connection you mentioned.

Thanks for your very PROPER and SIMPLE explanation. This really helped for exact problem solution - had increased your Karma twice :wink: