FAT32 write Problem

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 32-bit PIC MCUs
Post Reply
Author
Message
Berni4
Posts: 16
Joined: 29 Jan 2013 22:20

FAT32 write Problem

#1 Post by Berni4 » 18 Oct 2019 14:52

Hi,

i try to use a SD card with my MMB for PIC32 to store some data.

This is my function:


void safeOnSD() {

strcat(&Label15_Caption, ".TXT");
fhandle = -1;
fhandle = FAT32_Open(&Label15_Caption, FILE_APPEND);
if(fhandle < 0) while(1);
FAT32_seek(fhandle, 0);

strcat(&writeBuffer, "Configuration:");
strcat(&writeBuffer, &LabelFRQ_Caption);
strcat(&writeBuffer, ",");
strcat(&writeBuffer, &LabelON_Caption);
strcat(&writeBuffer, ",");
strcat(&writeBuffer, &LabelOFF_Caption);
strcat(&writeBuffer, ",");
strcat(&writeBuffer, &LabelVOLT1_Caption);
strcat(&writeBuffer, ",");
strcat(&writeBuffer, &LabelVOLT2_Caption);
strcat(&writeBuffer, ",");
strcat(&writeBuffer, &LabelMode_Caption);
strcat(&writeBuffer, ", **END OF CONFIGURATION**");

err = FAT32_Write(fhandle, &writeBuffer, sizeof(writeBuffer));
if(err < 0) while(1);
err = FAT32_Close(fhandle);
if(err < 0) while(1);

DrawScreen(&Screen1);

}

After a first use of it, it generates a file with the name of my Label15_Caption and the contend of writeBuffer.
This i also can see on mi PC when i plug in the SD card.

After this i like to manipulate the data for a second file. Then i call the same function, but now it only generate a file with the new name from Label15_Caption without a contend.

So ony the first file have the right contend, all other files ar generatet with new names but all without contend.

What od i wrong?

Best regard,
Berni
Attachments
Programmer V2.zip
(2.74 MiB) Downloaded 103 times

Berni4
Posts: 16
Joined: 29 Jan 2013 22:20

Re: FAT32 write Problem

#2 Post by Berni4 » 19 Oct 2019 11:43

Hi,

here i´m again.

I have found an other user with the same problem: viewtopic.php?f=178&t=71746&hilit=FAT32+empty

but with the STM Hardware.

They highre the Allocation Unit Size i formatt the card they higher the correct (not empty) files i can save.

I think i use the current lib version. How can i see the installed version?

BR,
Berni

Berni4
Posts: 16
Joined: 29 Jan 2013 22:20

Re: FAT32 write Problem

#3 Post by Berni4 » 19 Oct 2019 11:54

The problem was the library i installed in february this year. The new lib works.


BR,
Berni

Post Reply

Return to “PIC32 PRO Compilers”