-->
Page 1 of 1

[Solved] Weird behavior while mounting SD card

PostPosted: Tue Dec 12, 2017 10:43 am
by ritesht93
Hi All,

I am using the NodeMCU Amica board and NodeMCU Lua firmware alongwith this SD card adapter (it has 3.3v regulator and level shifter built in).

I built the firmware using both docker and cloud service enabling SPI module (+ default modules) and FatFS support. I also formatted this 128 MB SD Card with official SD formatter utitlity to have FAT/FAT16 filesystem.

According to this pin out diagram:

Image

D5 to D8 represent HSPI. So I made the connections in the following way:

    nodemcu 3.3v -> sdcard board Vcc
    nodemcu GND -> sdcard board GND
    nodemcu D5 -> sdcard board SCK
    nodemcu D6 -> sdcard board MISO
    nodemcu D7 -> sdcard board MOSI
    nodemcu D8 -> sdcard board CS

After initializing HSPI like this:

Code: Select allspi.setup(1, spi.MASTER, spi.CPOL_LOW, spi.CPHA_LOW, 8, 8)

After i run the following line

Code: Select allvol = file.mount("/SD0", 8 );


ESP hangs for about 2 seconds and exits giving me nil in vol.

I also tried powering up sdcard module with external Arduino Uno +5V volts but the same issue persists. I also tried using Vin and GND from NodeMCU so that the SD card module uses common ground from USB supply, but to no avail.

I also tried switching Chip Select (CS) pin from D8 to D2 and issued the command:
Code: Select all vol = file.mount("/SD0″, 2);
but the same problem is present. vol is still nil and it doesn't mount.

Just a side note: I am able to read/write successfully using Arduino Uno and the same sd card module and same sd card (tried both 128 MB and 4 GB). I also flashed the both ReadWrite.ino and cardinfo.ino examples onto ESP and both are working fine (using same sd card module and same sd card).

Has anyone tried the aforementioned sdcard adapter or any other adapter that works with NodeMCU Devkit and Lua firmware. I'm stuck over this since few days. Don't understand what seems to be the issue? Do I have use a different flash frequency while flashing binary image firmware using esptool.py? or something else is out of place?

Any help is appreciated ! Thanks

Edit: Solved this a while ago. Actually it turned out to be a power issue.

Re: [Solved] Weird behavior while mounting SD card

PostPosted: Wed Aug 12, 2020 11:18 pm
by Blenta
Hi guys,

I am running into the same problem. Could you please explain how to solve this power issue?

Thanks in advance!
Blenta