Smallest file size possible on SDCard in FAT16?

Coding and general discussion relating to user created compiler modules

Moderators: David Barker, Jerry Messina

Post Reply
liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

Smallest file size possible on SDCard in FAT16?

Post by liak » Fri Jan 09, 2009 12:58 am

Dear all,

I am having a slight problem in transferring data from PIC to SDCard. I have been using the PIC to write data onto SDCard direct to each sector, bypassing the FAT protocol. However this becomes too slow when the bulk of data increases --> it takes more than 1 hour to write only 6Mb.
I am wondering if there could possibly be a way to write the data using PC(laptop) straight to SDCard. The BIG problem I see is this:
PC / Windows uses FAT structure. My PIC writes direct to SDCard sector not using FAT. So I may want to know:

Can I write to only a single sector on the SDCard using Windows. And I will need to write many of them in sequence of one after another. Can anyone suggest how to do this?

If I am not clear enough in my question, please point out.
BTW, I am using Steven's sdfilesystem module ver 4.0.9.
The specific subroutines I used are ReadSector and WriteSector.

Thanks.

Regards,
Liak

User avatar
Steven
BETA Tester
Posts: 406
Joined: Tue Oct 03, 2006 8:32 pm
Location: Cumbria, UK

Post by Steven » Fri Jan 09, 2009 7:47 am

Why not switch to writing using FAT - the library by itself, run on a 40MHz PIC could write 6MB in less than 2 minutes. Or maybe there is something that we could do to speed up your code - can you post it?

liak
Registered User
Registered User
Posts: 195
Joined: Fri Oct 05, 2007 12:26 am

More on FAT structure...

Post by liak » Fri Jan 09, 2009 10:52 am

Dear Steven,
Thanks for the reply. Indeed Steven, I am hoping to be able to write the data onto SD card direct using the PC and then reading it using PIC. That is my ultimate goal. Sorry for not able to make it clear earlier.

In my earlier posts replied by you also, I did what you have proposed, ie handling the data directly by myself bypassing the FAT. It seems more efficient kept that way. Since my program now runs smoothly and is quite large now, it may be difficult to change it without making major overhaul.

Now what I am trying to achieve is to write the data from PC in if possible the following layout:

1. writing the data in specific number sector decided by me
2. data to be filled in to each sector in sequential order

The reason being, that my PIC reads data from the SD card starting from an index sector then proceed sequentially to the next. So you can say that it's smallest working unit is a sector.

At the moment, I am a bit unsure of my understanding of the FAT structure. If I am correct, FAT will determine the sequence which sector to start the file, so I may not be able to do (1). And FAT may jump from cluster to cluster in a single file, so I may again not be able to do (2).

Because writing with PC is much faster, I am asking help if anyone can give any ideas to start me off.

Thanks.

Regards,
Liak

Post Reply