SD library

I took a look at git, I’ve even downloaded some of it
need a quiet few minutes to absorb it all :smiley:

another week another progress report

I can now read FAT32 and follow a file around the FAT
I decided not to try and support FAT12, FAT16 and FAT32 all at the same time
mainly due to code size restrictions

I’m also settling on “8.3” files in the root folder

that’s all I need for my project
may re-visit and expand one day when I’m bored

along the way, as you’d expect, I’ve had to re-visit the sd and spi libraries
initialising “large” cards is non-trivial!

but I can pop in a 32 Mbyte (FAT12), 512 Mbyte (FAT16) and 4 Gbyte (FAT32) card and read from them successfully

mount times aren’t too shabby either
4 Gb only takes 250 mS to get started on a cold morning
block reads for all 3 seem to be around 12 mS for 512 bytes

once I’ve tidied the code up I’ll re-issue the libraries

:smiley:

Good to hear that you got it working! Did you write the SD code from scratch, or did you adapt FatFs or some other code that’s already out there?

- Kevin

nah wrote it from scratch
porting someone else’s work when I didn’t know what it was doing seemed like a plan for doom!

fileWrite working now also
only works for existing files
didn’t want to slow the writes by stopping to find the next cluster
will probably implement a fileCreate to make files ready for writing!

now that it’s all hanging together I’ll move to interrupt or DMA based transfers
can’t afford to hang around between blocks

that will also give the possibility of having multiple buffers
maybe a ring of them fill one, start the write, move on the next

oh - and still got space for some “real code” outside the drivers :phew: