Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Bugs and solutions - new and historic

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> KokkeKat FAT-free SD card lib
View previous topic :: View next topic  
Author Message
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Mon Jul 11, 2011 12:35 pm    Post subject: Bugs and solutions - new and historic Reply with quote

There is a v1.0 bug in Sdcreatefileordir:. Add the two lines (at about row 1400) I have highlighted below:

Code:

      ' An available (previously erased) directory entry or EOD End Of Directory marker found
      ' Sddirclusterd, Sddirsecincluster, and Sddirbufferpos now point to this directory entry
      If Sdstatus = 28 Or Sdstatus = 32 Then                ' Free directory entry found
         Sdstatus = 0                                       ' Remap Sdstatus

         ' Find free FAT1 entry and store position in Sdfatsectornum, and Sdfatbufferpos plus Sdfatclusterd
         Sdsectord = Sdfatsectornum                         ' Continue looking in the same FAT sector
         Sdbufferpos = Sdfatbufferpos
         Gosub Sdfindfreefat
         If Sdstatus = 0 Then

            Gosub Sdlocatedirsector                         ' Point to the available directory entry again
            Sdsectord = Sdsectord + Sddirsecincluster       '<--- new line
            Decr Sdsectord                                  '<--- new line

            #if Sdwmode = 1
               Sdreaddestination = 0
            #endif
            Gosub Sdreadsector
 


This bug is fixed in v1.2 of the library that is published in sticky thread "Latest release".


Last edited by KokkeKat on Sun Sep 11, 2011 7:19 pm; edited 6 times in total
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Sun Sep 11, 2011 3:46 pm    Post subject: Reply with quote

There is a v1.0 bug in the library. It's in Sdcreatefileordir, around line 1344 in KokkeKat_FAT-free_SD_lib_code.bas:

Code:


  Gosub Sdwritesector
  If Sdstatus = 0 Then
     Sdsectord = Sdsectord - Sdfat1location       ' <--- change to this
     Sdsectord = Sdsectord + Sdfat2location
     Gosub Sdwritesector
     If Sdstatus = 0 Then

 


This bug is fixed in v1.2 of the library that is published in sticky thread "Latest release".
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Sun Oct 30, 2011 9:49 pm    Post subject: Reply with quote

Hi

This doesn't really qualify as a bug, but please note that you must make sure to set Sdstatus to 0 before calling Sdreadfsinfo or Sdwritefsinfo.

Otherwise, you will have a timeout problem after Sddirlistdelete, that ends with Sdstatus being 31 when successful. (Most other routines end with Sdstatus being 0 when successful.)

Kind regards

Niclas
Back to top
View user's profile
KokkeKat

Bascom Member



Joined: 08 May 2011
Posts: 59
Location: Stockholm

sweden.gif
PostPosted: Sun Jul 22, 2012 8:46 pm    Post subject: Reply with quote

Please make sure to initialize all variables before starting a new file operation. Many thanks to Benoit for reporting the below:

"sdeof must be set to 0. sdbytesread must be set to 0 at the begining otherwise when you reenter the file eof is directly set to 1 because sdbyteread not reseted and file end is reached."

This affects Example_FIND_READ_FILE and Example_DIRLIST_READ_FILE (and possibly also other examples).

Kind regards

Niclas
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> KokkeKat FAT-free SD card lib All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum