Arduino MEGA and TFT 3,5, cannot start SD

Hello everyone,
I have a brand new Arduino Mega (clone) and I´m trying ti display an image on it. All the examples work fine and display is up and running, however when I try to upload the "showBMP_not_UNO.ino" from the examples, after upload it says
Show BMP files on TFT with ID:0x9486
cannot start SD

The display is https://techfun.sk/produkt/tft-display-shield-3-5-pre-arduino-uno-s-sd-kartou/ and all other examples work fine.

I´ve uninstalled the Adafruit SD library, so the only one in use is sdFat the most recent version.

I´ve checked this with friend and he hasn´t found any connection issues and we both think that pinout is working fine, as all other examples work OK.

I don´t have another SD card, the current one is from old Nokia phone 2 GB and formatted with FAT32.

Hoping it´s some basic issue I can solve pretty straight-forward

Thank you very much in forward for any help

showBMP_not_Uno.ino (10.0 KB)

You are likely to get faster help if you post the code properly.

Please read the forum guidelines to see how to properly post code and some information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please post a schematic. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.

I´ve included the display I´m using and the code is just taken from the examples of the library used. The post has all the relevant info.

Alright, I will reply myself here and hopefully this will help somebody later on, I got it working! :slight_smile:

Firstly, I found out that Mega has the SPI pins 50-53. I'm not very skilled Arduino developer, but we all learn every day. Mistake #1 - bought a display for Uno as I needed it before Christmas and was ordering it on 21st :roll_eyes:
The core thing here was that even though I defined the SD_CS pin in a config as pin 10 (which is actually on the original shield correct for this operation), Mega didn't care about that. Once I correctly connected these 4 pins, I got a communication with the CardInfo.ino that is from the original SD library. As I was aware that I have to use the sdFat because of Mega, I needed to somehow find out why the sdFat library doesn´t work for me.
Mistake #2 - you don´t really need sdFat library in order to get this running.

The truth is, even though for the original SD Library CardInfo went fine and I was able to communicate with the SD card, for some reason with the same wiring and connections, the sdFat library just doesn´t work. I can´t connect to the SD card at all.

SD errorCode: SD_CARD_ERROR_INVALID_CARD_CONFIG = 0x2b
SD errorData = 0x0

So I gave up and started looking for a way how to use the original SD library, as this was working for me fine.

Basically, this video says it all Arduino Mega 2560 + MCUFriend 3.5" TFT: DIY Gauges, read bmp imagines from SD - YouTube. I wish I could’ve find it two days ago :joy:

The thing is - even though you're using MEGA and not UNO, you can use the same file from examples showBMP_kbv_Uno. You just need to define the SD_CS pin and you're good to go! The sdFat library is still dead for me, but I don´t need it anyway.

I´ve attached a working ino file.

Time for a beer,
showBMP_kbv_Uno_edited_for_Mega.ino (9.5 KB)
Merry Christmas!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.