Issue with mounting of SD card
JChris
Posts: 58
Hello, I am trying to save data into SD card but I have an issue with mounting of SD card.
I have formatted my micro SD card in FAT16 and FAT32 (with a software and also directly with the computer) and I have the following program but I don't understand why my SD card do not mount :
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
PC_Rx = 31
PC_Tx = 30
PC_Baud = 115200
TX_PIN = 4
BAUD = 9600
DO = 0
CLK = 1
DI = 2
CS = 3
WP = -1
CD = -1
RTCIO = -1
RTCSCLK = -1
RTCCE = -1
Var
long data[50], donnee[10]
long OK, mount
OBJ
PC : "FullDuplexSerial"
LCD : "FullDuplexSerial"
SD : "DS1302_SD-MMC_FATEngine"
Pub Main
LCD.start(TX_PIN, TX_PIN, 0, BAUD)
waitcnt(clkfreq / 100 + cnt)
LCD.tx(12)
waitcnt(clkfreq + cnt)
LCD.tx(17)
waitcnt(clkfreq + cnt)
microSD
PUB microSD
OK := \SD.FATEngineStart(DO, CLK, DI, CS, WP, CD, RTCIO, RTCSCLK, RTCCE)
if OK == true
LCD.Str(String("driver launched"))
else
LCD.Str(String("error"))
mount := \SD.mountPartition(0)
if mount == false
LCD.Str(String("SD card mounted"))
else
LCD.Str(String("SD card not mounted"))
SD.openFile("coucou", "w")
SD.writeString(@donnee)
Any help would be appreciated
I have formatted my micro SD card in FAT16 and FAT32 (with a software and also directly with the computer) and I have the following program but I don't understand why my SD card do not mount :
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
PC_Rx = 31
PC_Tx = 30
PC_Baud = 115200
TX_PIN = 4
BAUD = 9600
DO = 0
CLK = 1
DI = 2
CS = 3
WP = -1
CD = -1
RTCIO = -1
RTCSCLK = -1
RTCCE = -1
Var
long data[50], donnee[10]
long OK, mount
OBJ
PC : "FullDuplexSerial"
LCD : "FullDuplexSerial"
SD : "DS1302_SD-MMC_FATEngine"
Pub Main
LCD.start(TX_PIN, TX_PIN, 0, BAUD)
waitcnt(clkfreq / 100 + cnt)
LCD.tx(12)
waitcnt(clkfreq + cnt)
LCD.tx(17)
waitcnt(clkfreq + cnt)
microSD
PUB microSD
OK := \SD.FATEngineStart(DO, CLK, DI, CS, WP, CD, RTCIO, RTCSCLK, RTCCE)
if OK == true
LCD.Str(String("driver launched"))
else
LCD.Str(String("error"))
mount := \SD.mountPartition(0)
if mount == false
LCD.Str(String("SD card mounted"))
else
LCD.Str(String("SD card not mounted"))
SD.openFile("coucou", "w")
SD.writeString(@donnee)
Any help would be appreciated
Comments
The documentation for the SD.mountPartition method says:
I think the partition is being mounted correctly and that you are misinterpreting the return code. If the partition was properly mounted this time but improperly unmounted last time, this method will return true. Don't assume failure if it returns true - only assume failure if it returns something other than true or false, such as a pointer to a string describing the error (which you can print onto your debug terminal).
And if yes, where I can find it?
So I have formatted my micro SD card with my computer and fixed the Disk.
I don't find any clue on Internet for fixed my problem.
Have you got an idea of the problem?