|Re: WP 34S USB flash adaptor arrived|
Message #54 Posted by Dale Reed on 29 Apr 2012, 11:03 p.m.,
in response to message #53 by Paul Dale
Pauli (and all),
I thought the additional pins might be an issue.
I tried to cover all the considerations I ran into in my project. A few last thoughts on SDCard implementation (based on my one hobby learning experience only) follow...
I've been working with regular size SDCards (again, easier to hand solder the socket to the PCB for these old eyes and hands...). For the full-size cards, you need to have the card detect input so you know when to initialize. And if you do any writes to the card, you need to have the write protect input, because it's a mechanical slider on the edge of the card, and you must respect it. (My project was read-only, but I pinned the write protect to an input anyway, just in case I wanted to do something else with the circuit.)
But as I think about it now, I'm pretty sure the MicroSD socket doesn't need a pin for write protect. I think it's done electronically (data on the card) rather than mechanically. So in addition to the SPI data in, data out, clock and slave select, I think you just need card detect. Maybe that helps.
Since my project was read-only, I only needed to develop disk_read(), disk_status() and disk_initialize(). If the whole SDCard thing is worth pursuing, I'd be more than happy to forward the source I developed for these --- but it's for the MC9S08QE32 and Freescale's SPI implementation. You're probably better off with the examples that come with FatFS for ARM code.
I had a couple hiccups with the READ_ONLY option on my compiler (Code Warrior), like a variable or two that were declared/initialized in code that was #ifdef'ed out. But I was using FatFS 0.6, and it's up to 0.9 now, so perhaps that's all fixed.
One last thought: when you create or modify a FAT file, you write a timestamp in the directory entry. If we'll be writing files to the card, we might also require having the clock crystal/capacitors and semi-reasonable timekeeping (if you want the file create/modify timestamps to make sense, that is). I didn't have to for my project, but this is one of the things that you have to provide in the disk_ioctl() code that you provide underneath FatFS. (And you have to provide disk_write(), of course.)
Hope this all helps....
p.s.: Apologies if this should have gone only to Pauli and not to everybody. But I always like learning the gory details from the postings here -- so I decided to err on the side of informing all.