SD2.0 Full FAT32/16 File Sytem Driver - You there! Yes you, viewing this forum.
Hey everybody,
I’ve think I’ve finally got a working release of the file system driver that I’ve been coding for about a year now. So, meet the SD2.0· FATEngine, a fully functional FAT32 and FAT16 file system driver that supports SD cards and ·MMC cards (kinda). The driver supports accessing files and directories across a SD card. So, no longer will you be limited to the root directory. By using the FATEngine you can now read and write to files in any directory on the SD card. Included with this are also the abilities to change your working directory, rename files and folders, change file and folder attributes, and delete files and empty folders. Additionally file and folder creation is supported so that your application can build any directory structure it needs. Last but not least, the file system support full directory listing capabilities so that you can query information about all the files and directories on the SD card.
So, to keep this post short I recommend you read through the driver which is attached and try out the EXTENSIVE included demo which will function as a serial interface into your SD card. Simply open the SD2.0 FATDemo file up and configure the constants correctly. After doing so load the demo on your prop chip and type in “help”, followed by enter, to see the command list which gives all the allowed command names and arguments for those commands in the demo. If you have some wav files and audio hardware on your board please check out the “play” and “record” commands which can play and record wav files – they are especially nice. Also, remember to use the "mount" command first to mount the SD card so that you can acess the file system.
Anyway, I would like to ask that if you have a problem with the driver, please post online here about the problem so that I can work to fix it. I don’t know if the block driver supports every SD card out there but I’ve had no failures so far with any of my test cards. I would also like if you could post the results of the “test” command back on the forum if you do use the demo so that I can see what the average read and write speeds are for certain operations.
Thank you,
·(Going to bed now, will answer questions later at 10 or 11 am EST).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 6/4/2010 3:03:27 PM GMT
I’ve think I’ve finally got a working release of the file system driver that I’ve been coding for about a year now. So, meet the SD2.0· FATEngine, a fully functional FAT32 and FAT16 file system driver that supports SD cards and ·MMC cards (kinda). The driver supports accessing files and directories across a SD card. So, no longer will you be limited to the root directory. By using the FATEngine you can now read and write to files in any directory on the SD card. Included with this are also the abilities to change your working directory, rename files and folders, change file and folder attributes, and delete files and empty folders. Additionally file and folder creation is supported so that your application can build any directory structure it needs. Last but not least, the file system support full directory listing capabilities so that you can query information about all the files and directories on the SD card.
So, to keep this post short I recommend you read through the driver which is attached and try out the EXTENSIVE included demo which will function as a serial interface into your SD card. Simply open the SD2.0 FATDemo file up and configure the constants correctly. After doing so load the demo on your prop chip and type in “help”, followed by enter, to see the command list which gives all the allowed command names and arguments for those commands in the demo. If you have some wav files and audio hardware on your board please check out the “play” and “record” commands which can play and record wav files – they are especially nice. Also, remember to use the "mount" command first to mount the SD card so that you can acess the file system.
Anyway, I would like to ask that if you have a problem with the driver, please post online here about the problem so that I can work to fix it. I don’t know if the block driver supports every SD card out there but I’ve had no failures so far with any of my test cards. I would also like if you could post the results of the “test” command back on the forum if you do use the demo so that I can see what the average read and write speeds are for certain operations.
Thank you,
·(Going to bed now, will answer questions later at 10 or 11 am EST).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 6/4/2010 3:03:27 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz
Just leave the clock pins in the constant section·unchanged. In this version I simply removed the abort statement for any clock I/O errors that happen. Invalid time stamps will be produced when this happens but·the driver will continue to work without a DS1307 RTC attached.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 6/7/2010 2:23:04 AM GMT
Amongst all those unix commands shouldn't "mkfil" be "touch"?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller
>_ Running command: test Creating test file "testfile" ... Success Wrote 131,072 bytes at 0000004297 bytes per second Running byte stride write test... Wrote 32,768 bytes at 0000002934 bytes per second Running byte stride read test... Read 32,768 bytes at 0000004297 bytes per second Running word stride write test... Wrote 65,5536 bytes at 0000004402 bytes per second Running word stride read test... Read 65,5536 bytes at 0000008419 bytes per second Running long stride write test... Wrote 131,072 bytes at 0000005869 bytes per second Running long stride read test... Read 131,072 bytes at 0000016525 bytes per second Running speed writing test (512 bytes at a time)... Wrote 131,072 bytes at 0000000000 bytes per second Running speed reading test (512 bytes at a time)... Read 131,072 bytes at 0000223600 bytes per second Running append test... Success Running seek test... Success Deleting test file "testfile" ... Success
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.
Yesterday I was using the previous version and I noticed a problem with directory two chars long.
This is the sequence of instructions:
mount 0--> Ok
mkdir PO --> dir created
ls --> I can see the folder
cd PO --> Directory not found
From three chars up then there is no problem, everything works great!
I will test this driver for the same issue and I let you know.
The raw write speed for my driver isn't very high always, I've noticed that it can range from about 160KB a sec down to like 30KB depending on which card you use... I'm not sure why this happens.
The file system allocation write speed however is very slow when creating a new file. Because whenever you want a new cluster you have to read in a fat sector and then from there search for a free cluster. After finding one which could take multiple reads you then have to write out that cluster claiming that sector. Then you have to zero every byte in the·cluster over multiple sectors·and then read in the first·sector of that cluster... Finally after all that you can write to the file.
@nicolad76 - Just tested that and found no prolems. Just FYI, the previous version had a $&!^ ton of bugs...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 6/4/2010 2:14:17 PM GMT
1Gig ones are working too.
>help Running command: help Command Listing <clear> - Clear the screen. <echo> <string> - Echo the string argument. <reboot> - Reboot the propeller chip. <help> - Show the command listing. <mount> <partition#> <check@> - Mount the file system. C=Check. <unmount> - Unmount the file system. <df> <fast> - Compute free sectors. F=Fast. 1 Sector = 512 Bytes. <du> <fast> - Compute used sectors. F=Fast. 1 Sector = 512 Bytes. <cd> <directory> - Change directory. <attrib> <entry> <newAttributes> - Change attributes. R=ReadOnly, H=Hidden, S=System, A=Archive. <rename> <oldName> <newName> - Rename a file or directory. <rm> <entry> - Remove a file or directory. <mkfil> <name> - Make a new file. <mkdir> <name> - Make a new directory. <boot> <file> - Reboot the propeller chip from a file. <format> <partition> <newLabel> - Format the selected partition and give it a new label. <ls> - List the contents of the working directory. <pwd> - Print the working directory path. <cat> <file> - Print the ASCII interpreted contents of a file. <test> - Test file system functions and read and write speed. <date> - Display the current date and time. <time> - Change the current date and time. <play> <file> - Play a wav file. <record> <file> - Record a wav file. >mount 0 Running command: mount 0 Disk 0x00000000 with volume ID 0xF8D75F5D a.k.a ready >test Running command: test Creating test file "testfile" ... Success Wrote 131,072 bytes at 0000022534 bytes per second Running byte stride write test... Wrote 32,768 bytes at 0000004332 bytes per second Running byte stride read test... Read 32,768 bytes at 0000004297 bytes per second Running word stride write test... Wrote 65,5536 bytes at 0000008454 bytes per second Running word stride read test... Read 65,5536 bytes at 0000008489 bytes per second Running long stride write test... Wrote 131,072 bytes at 0000016141 bytes per second Running long stride read test... Read 131,072 bytes at 0000016839 bytes per second Running speed writing test (512 bytes at a time)... Wrote 131,072 bytes at 0000160992 bytes per second Running speed reading test (512 bytes at a time)... Read 131,072 bytes at 0000268320 bytes per second Running append test... Success Running seek test... Success Deleting test file "testfile" ... Success >
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller
Post Edited (Dr_Acula) : 6/4/2010 2:46:17 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Why do you have to zero a new cluster? It's going to be written over anyway.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Check out my new website!!
Use the Propeller icon!!
Follow me on Twitter! Search "Microcontrolled"
Bill
I tried this with a 1 GB HP SD card, it works great.· Here are the results:
>_ mount 0 Running command: mount 0 Disk 0x00000000 with volume ID 0xFC303DA9 a.k.a ready >_ test Running command: test Creating test file "testfile" ... Success Wrote 131,072 bytes at 0000031688 bytes per second Running byte stride write test... Wrote 32,768 bytes at 0000004157 bytes per second Running byte stride read test... Read 32,768 bytes at 0000004297 bytes per second Running word stride write test... Wrote 65,5536 bytes at 0000007721 bytes per second Running word stride read test... Read 65,5536 bytes at 0000008454 bytes per second Running long stride write test... Wrote 131,072 bytes at 0000013416 bytes per second Running long stride read test... Read 131,072 bytes at 0000016735 bytes per second Running speed writing test (512 bytes at a time)... Wrote 131,072 bytes at 0000053664 bytes per second Running speed reading test (512 bytes at a time)... Read 131,072 bytes at 0000241488 bytes per second Running append test... Success Running seek test... Success Deleting test file "testfile" ... Success >_
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the Propeller Powered SIG·fourm kindly hosted at Savage Circuits
Game(s) Mythic Flight
Utilities Font Editors (AIGeneric, Potato_Text, etc.)
Please keep the test results comming. I need to calculate an average. If no one has any problems I'll put the driver in the OBEX.
Thanks,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 6/4/2010 6:34:57 PM GMT
Wrote 131,072 bytes at 0000030954 bytes per second Running byte stride write test... Wrote 32,768 bytes at 0000004087 bytes per second Running byte stride read test... Read 32,768 bytes at 0000004297 bytes per second Running word stride write test... Wrote 65,5536 bytes at 0000007511 bytes per second Running word stride read test... Read 65,5536 bytes at 0000008489 bytes per second Running long stride write test... Wrote 131,072 bytes at 0000013031 bytes per second Running long stride read test... Read 131,072 bytes at 0000016944 bytes per second Running speed writing test (512 bytes at a time)... Wrote 131,072 bytes at 0000044720 bytes per second Running speed reading test (512 bytes at a time)... Read 131,072 bytes at 0000286208 bytes per second Running append test... Success Running seek test... Success
2 Gig Lexar
My 2Gig Zap glider doesn't work though. [noparse]:([/noparse]
Anyone running @ 100 Mhz?
Jim
I'm running Base Pin 0 and getting mount failure.
Post Edited (hover1) : 6/4/2010 7:34:37 PM GMT
That said, even with 8.3 file names this is great code and thanks for your efforts.
Jim
U so smart
Will this work ok with big sd cards?
Like 8gb ones.....
It gets great read and write speeds. I have about 40 WAV files on the card across different directories and I can play all of them.
@Wurlitzer·- If I were to do that it really wouldn't be FAT16/32 compatible anymore. So, I really can't do that.
However, you could just make your files have their name stored as the first 256 bytes in the file.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 6/4/2010 8:18:46 PM GMT
Very nice Kye! Nice job on the entire suite! Can't wait to get a DS1307 now! (Should have been in my bins a long time ago).
Jim
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Talbot
New Market, MD, USA
I'll be sure to post a couple different test cases with the SD cards I have on hand.
Good job Kye!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, P.E.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" 16:9 LCD Composite video display, eProto for SunSPOT, PropNET, PolkaDOT-51
www.tdswieter.com
The DAC Engine and the FAT Engine are all you need to play wav files. I also have the code necessary to do so in the function called "play".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
I'm busy making your code jump through hoops. It works very well.
I just posted a long posting asking about bootloading.
I've just deleted that post. Because I found the "boot" command. And it works!!!!
This is awesome. Just what I needed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller
Post Edited (Dr_Acula) : 6/5/2010 12:50:19 PM GMT
but
what we have is an operating system that boots up using local VGA and keyboard. I compiled Femtobasic into a binary and renamed it FBAS.BIN and put that on the sd card, then run the command
BOOT FBAS.BIN
and it boots into Femtobasic.
It is a little slower than propdos to copy the bytes over but only a couple of seconds.
This is a standalone operating system! Life is very good. Thanks kye.
Next step might be to print out all the binary files on bootup. And add the option propdos has where you don't have to type "boot" - if you just type the name of the file and it is a .bin file then it runs.
addit: I can post code if you like but it is a real mess.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.smarthome.viviti.com/propeller