Re: Compact flash transfer rate (w/microcontroller)






Ohh yesss definately. Again, especially the code writing and reading a
sector is VERY important. I got the best results by also using A10
that said the so called but totally missleading "memory mapped mode".
There you can use special block move operations your controller might
support (as it's the case with the R2000 i.e.). Note thought that the
difference is not all that big.



The C versus assembly story is of course different when it comes to
implementing FAT. I never ever would consider implementing FAT in
assembly these days. That's an area where 'C' is much more apropriate.

So a good idea may be implementing low-level sector access routines is asm, and using them in C for handling FAT16...




And what about the impact of:
- memory buffers


You must buffer wisely.

I just need one file, and as you suggest I might pre-map it with fixed size, for example filling it with 0, and then changing only the data sectors...(with no overhead updating the fat)
Shall the buffering unit be one sector or one cluster?



But definitely, as I have only to append new data to existing one in the flash.. what happens when I issue to the flash a WRITE SECTOR command?


After writing the command register and the other ones, the flash expects 512 bytes to be written (with A2 A1 A0 set to 0 0 0 , right?)

But, what happens if I write for example only 20 bytes, then I wait some time by letting my cpu doing other things, and then write other 60 bytes, then I wait some time doing some calculations and finally write the remaining 512-20-60 bytes?

I mean... can I use the CF as a single sector buffer? Or just have I to write all the 512B of a sector in a single shot with no interruptions?





I'm one of those crazy people who are faster in writing their own
library than understanding someone elses code :-) Seriousely, I had to
write all of it on my own for various reasons.

yeah! I'm one of those guys too! (...sometimes :-) )




However, if you only are after logging data, you can prealocate the
file in a first simple step, then simply write consecutive sectors
during the real logging. If you do this cleverly, you really don't
have to have much really FAT specific code hence you might save lots
of time.

Good hint, tnx.



> Don't expect to be able to port existing say Linux FAT Code
to an 8 bitter though.

Didn't even think about this! :-)




Code that deals with sector IO should be readily available. If you
really are in the dare need of this, I can help you out.


Thank you, I already have found something, I'll first check this out.



Markus, thanks for the wise advices and the good hints, it was a really helpful discussion. Bye!
Aldo
.




Relevant Pages

  • Re: Compact flash transfer rate (w/microcontroller)
    ... Considering that you also update the fat, ... Single sector writes are just fine. ... that said the so called but totally missleading "memory mapped mode". ...
    (comp.arch.embedded)
  • Re: fsck.vfat malloc trouble
    ... Top shows it does indeed allocate all remaining memory. ... The filesystem is 153G. ... There are differences between boot sector and its backup. ... First FAT starts at byte 16384 ...
    (alt.os.linux)
  • Re: The 9997th file specific DOSFS problem
    ... Thought it is already using 32 KB sector size. ... The 512 bytes "tiny cache" for the FAT is very intersting. ... and should not be confused with the cluster ...
    (comp.os.vxworks)
  • Re: HD gone after Word wrote the first sectors
    ... >>> I tried (I had a backup of that sector) to put back the first sector ... >>> to recover the 2nd partition with all files. ... >> A few times lately I have seen that the FAT in the beginning of the ... >> root cluster, examine that the partition is OK using the second FAT ...
    (comp.sys.ibm.pc.hardware.storage)
  • Re: HD gone after Word wrote the first sectors
    ... >> I tried (I had a backup of that sector) to put back the first sector ... >> to recover the 2nd partition with all files. ... > disk is printed using the alternative FAT finding format with Distance ... > root cluster, examine that the partition is OK using the second FAT ...
    (comp.sys.ibm.pc.hardware.storage)