microsd - how long do you wait before trying to access

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I want to give the user enough time to make sure the card is seated - the socket I'm using seems especially touchy with the CD signal.  It switches it to ground or open and so I'm using a mega pin as an input with pull up.  Even if I push the card in, but it hasn't even engaged the spring yet (push push type), it starts toggling the CD switch!  Once fully seated it is solid and once fully removed it is solid.  This is just a test socket with pins for a breadboard, not a final thing I will be using.

 

Still, it begs the question, once you see the CD signal going solid to indicate a card is present, do you build a timeout into card mounting?  I'm thinking about 500ms of CD being solid on before it tries to mount the card using FATFS.  Do you wait a certain amount of time?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After CD becomes active you could repeatedly try to read a block from the card.
After 'n' successful reads your card is ready.


If you're using ChaNs' FatFs you could repeatedly call mmc_disk_initialize() until it succeeds.