News:

;) This forum is the property of Proton software developers

Main Menu

SD File System Problem

Started by charliecoutas, Today at 10:38 AM

Previous topic - Next topic

charliecoutas

I'm really struggling with an SD card problem. I have discovered that everything works fine as long as my software created the files on the SD card. If Win10 "saves" a file to the SD card then I can't open it. Is there anything wrong with the following, it has this problem: I only get 3+4 beeps if I created the file

              While
                  If FAT_Init() <> cErrOK Then         ;Is FAT initialised?   
                       Toggle Led                      ;quick flash of led means no card seen                                                 
                       DelayMS 100
                       Else
                       Break                                                       
                  EndIf                       
               Wend     
       
               MyFileName = "TR_0025.TXT"
               
               If File_Exists(MyFileName) = True Then             
                   Sounder(3)                                                       ;sounder does x beeps
                   File_Rename(MyFileName, "ITA2.TXT")
                   Sounder(4)
                   Stop       
               EndIf
        Stop       

If TR_0025.txt is created by me, then it works, otherwise TR_0025.TXT is not found.
The cpu is PIC24HJ128GP504 and the version of FileSys24 is from INCLUDES folder. FileSys24.INC file is dated 05/07/2023

Charlie

RGV250

Hi Charlie,
My guess is that windows is adding formatting characters, what happens if you use notepad or notepad++ in Windows to create the file?

Bob

charliecoutas

Hi Bob,

I did use Notepad to save the file. It was typed into notepad so there wouldn't be any fancy formatting.

I'll try to look at the directory from an engine room point of view.

Charlie

streborc

You might want to try EditPad-Lite, a free (for personal use) text editor (https://www.editpadlite.com/).

RGV250

Hi Charlie,
Are they empty files that you have just created. If they have contents it might be worth a look with Winmerge to compare the 2?

Bob

charliecoutas

Thanks Bob, Streborc

No, they contain plain text, nothing fancy. Notepad is about as basic as you can get, I don't think it can be to blame.

Does anybody know if the FileSys24 routines have had any problems like this?

Charlie

trastikata

#6
Hello Charlie,

it doesn't matter how the file has been created, the library looks for the beginning of the FAT entry and that's all.

Try this SD card library, I've optimized Les' FileSys24 routines and cleared some anomalies, I have vague recollection that there was problem with the rename command in the original FileSys24, specifically the internal string conversion to capital letters to compare file names with the FAT entry:

https://picgraphic.com/TftLibrary2/TFT%20Graphic%20Library%202.html

Best regards.

charliecoutas

Many thanks, I'll try it.