Ok, so here are the setting:
- Arduino IDE 1.85
- Arduino Mega 2560
- Pin connections: CS-> 53 | MOSI -> 50 | MISO-> 51 | SCK-> 52 | VCC -> 5V | GND->GND
- sD CARD adapter: https://www.amazon.it/Skynet-Lettore-scheda-Arduino-Raspberry/dp/B01DNXWVES
- The microsd is 2GB
Problem: I keep getting SD card initialization failed when I use sketch examples like SDInfo from SD library or even SdFat library. Been trying for over 3-4 days so far and still nothing at all.
Things I've tried:
- Formatting the SD with the default software provided by this forum.
- Changing the CS pin from 53 to 10 or even 4 (although I suppose the default pin for Mega is 53)
- Added these 2 lines inside the void setup()
pinMode(53, OUTPUT);
digitalWrite(53,HIGH);
4.Added a sample .txt file with no text in it (read somewhere it needed an empty file after formatting)
5. Changed SD library version from 1.2.2 (the latest) to 1.0.8 or 1.0.9 or even 1.1.1
6. Change VCC from 5v to 3,3v
7.Before purchasing this sd card adaptor, I used another one for the big SD cards (the one with 8 pins if I'm not mistaken) and same problem!
Notes: the sd card works perfectly fine on Windows and as a smartphone external sd.
The sd card adaptor is new and from a trusted vendor but when connected to arduino, there's no led from it blinking or turned on (I don't know if there should be one)
The R17 led on arduino stays on (red colour)
The R18 led on arduino stays on (green colour)
EDIT: Ok solved this problem! All I had to do was reverse pins MOSI and MISO, so
MOSI-> 51 and MISO-> 50
Apparently, some microsd modules do have different pinouts then the rest.
Now the problem I'm encountering is the following one:
Initializing SD card...Wiring is correct and a card is present.
Card type: SD2
Could not find FAT16/FAT32 partition.
Make sure you've formatted the card
Any help please?