I am trying to connect CATALEX MicroSD Card adaptor to new NodeMCU V3 and PIN configuration are as below,
NodeMCU ---------> SD Card
GPIO13 (D7) ------> MOSI
GPIO12 (D6) ------> MISO
GPIO14 (D5) ------> SCK
GPIO15 (D8) ------> CS
VCC (3.3V) -------> VCC
GND --------------> GND
Tested above setup with QuickStart program from SdFat library in Arduino IDE. But it gives error output as below,
SPI pins:
MISO: 12
MOSI: 13
SCK: 14
SS: 15
SD chip select is the key hardware option.
Common values are:
Arduino Ethernet shield, pin 4
Sparkfun SD shield, pin 8
Adafruit SD shields and modules, pin 10
Enter the chip select pin number: 15
Disabling SPI device on pin 10
Can't access SD card. Do not reformat.
No card, wrong chip select pin, or SPI problem?
SD errorCode: 0X20,0XFF
SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is chipSelect set to the correct value?
Does another SPI device need to be disabled?
Is there a wiring/soldering problem?
errorCode: 0x20, errorData: 0xff
chipSelect is 15.
Also, I am using SanDisk 16GB Micro SDHC class 4 Memory Card.
I have tried googling with the error but did not find solution. Please help me.
-
use the SD library. the esp8266 version. it is a part of the esp8266 arduino package. you can find the examples in IDE Examples menuJuraj– Juraj ♦2018年07月18日 16:55:40 +00:00Commented Jul 18, 2018 at 16:55
-
Tried CardInfo program with SD library as well and it gives initialization failed error.Akshay– Akshay2018年07月18日 17:02:14 +00:00Commented Jul 18, 2018 at 17:02
-
the adapter has a 5 V to 3.3 V conversion? like this one? arduitronics.com/product/210/microsd-card-adapter-catalexJuraj– Juraj ♦2018年07月18日 17:20:38 +00:00Commented Jul 18, 2018 at 17:20
-
@Juraj: The NodeMCU's SPI pins are 3.3V-ish.gone– gone2018年07月18日 17:49:14 +00:00Commented Jul 18, 2018 at 17:49
-
@yeti, I know and if the SD adapter is 5 V then there is the problemJuraj– Juraj ♦2018年07月18日 18:39:07 +00:00Commented Jul 18, 2018 at 18:39
2 Answers 2
SD cards work on 3.3 V, so the adapter has 5 V to 3.3 conversion for power and signal, to connect SD card reader to a 5 V MCU. You can't connect this SD card adapter to an 3.3 V MCU like the esp8266.
-
but I would connect the adapter to 5V pin for a test2018年07月19日 05:54:25 +00:00Commented Jul 19, 2018 at 5:54
-
NodeMCU has VIN pin which shows voltage around 4.25 V, can this be connected to VCC of the SD card? Or should I use external 5 V power supply?Akshay– Akshay2018年07月19日 06:25:32 +00:00Commented Jul 19, 2018 at 6:25
-
I work with Wemos and there is a 5 V pin. I thought NodeMcu has it too. I don't know it the Vin of NodeMcu can be used to power devices.2018年07月19日 06:59:13 +00:00Commented Jul 19, 2018 at 6:59
-
Thank you, it worked with VU pin of nodemcu which provide 5V supplyAkshay– Akshay2018年07月19日 13:56:19 +00:00Commented Jul 19, 2018 at 13:56
-
This is brilliant, works as a charm surely. I have just tried it out was facing a similar challenge, though for my case the output voltage on VIN is 4.75VJoel Muhanguzi– Joel Muhanguzi2021年05月04日 09:55:53 +00:00Commented May 4, 2021 at 9:55
If you are giving power to nodemcu through USB cable. SD card VCC can be connected to the VIN pin of nodemcu ESP8266. I faced the same problem
NodeMCU V3 + SD Card with Arduino IDE Not working
but after connecting VCC of SD Card to VIN pin of nodemcu. it worked.
Thanks for the helping me Mr. Juraj