Micro SD Card Duplicator 1 (By Request)

Another by request post!

As a computer science student I'm excited to be given 'real' work to do. Microcontrollers and coding are my passion - something I don't get to do at all in my day job as an electrical engineer. Things are about to change though. I have resigned from my job and am returning to uni full time this year. The target is 8 high distinctions. After that I will have only 3 subjects remaining in my degree program. I hope my grades will earn me a place in the honours programme and from there who knows. I hope that in the gaps between my studies I'll develop some real-world useful projects, like this one.



My good friend Ross is a Bible translator. His current work is in Vanuatu leading the translation effort there. As part of making the Bible useful to people in their native language, he is recording, editing and releasing the audio of Bible translations for locals to 'own' on their own digital media player. The MegaVoice was invented for just this purpose. This is a cool gadget. It's self-contained, solar charging, simple to use and stores gigabytes of content. "Good luck building a better one of those!" you may say. Well I'm not going to try.

The need Ross has is to duplicate content for the MegaVoice devices. He may correct me on this, but I imagine this scenario. A new chunk of the Bible is translated into a language where people already have part of the Bible in their language (it's a big book, you don't translate it all at once). They also have MegaVoice players and all of "their Bible" on it. Ross would like to go to an island with an 'update' for the MegaVoice owners. He needs to:

  1. Meet with the folks who's Bible has been updated
  2. Celebrate the new work that was done with and for them
  3. Collect micro SD cards from the folks with MegaVoice devices
  4. Duplicate his master micro SD card onto all the other cards
  5. Reinsert the cards into the players and return them, updated, to their owners
For an added factor of difficulty, the card duplicator must:
  • Copy from one source card to more than one destination card at a time
  • Be a reliable as a pair of boots
  • Do it fast!
  • Do it without the help of a PC or laptop
  • Be a small, portable device suitable to be thrown into a backpack for small aircraft flights, small boat trips and hiking
  • Be battery powered
  • Be rechargeable from a number of sources
At the outset this doesn't seem difficult. SD cards natively support SPI communications. I can daisy-chain these off an Arduino and get the basic functionality going in no time. All I need are:
Having already ordered these, I figure I'll wire them up on a breadboard and use the existing SD library available for Arduino to prototype a solution. It'll all come down to what kind of data throughput I can achieve. If my Arduino Duemilanove (8-bit, 16MHz) can operate the SPI bus fast enough, then great. If not, I'll work my way up. Probably the next step is an Arduino Due (32-bit, 84MHz). The Due has the added benefit of being 3.3V, so the level shifting IC's can be ditched. Shoot, I just found the Stellaris LM4F120 LaunchPad that has 4 SPIs!

The SPI protocol doesn't define a maximum clock speed, so we should be able to keep cranking up the speed until the card itself can't keep up. If we can't smash SPI fast enough then we're kind of at a limit. The only other interface for microSD is SDIO and LadyAda says that's too hard to be worth it. I'm only investigating that if I'm desperate.

Sounds easy huh? I'll bet it's not. The real "goodness" is going to come from making the thing resilient to all kinds of issues. Not only does the core coding need to be bug-free, and any bugs discovered in libraries used eradicated, but then we need to fuzz it like crazy. Give it the wrong sized SD cards. Format them with the wrong file systems. Use a variety of brands, sizes and types. Use read only and corrupted cards; heck, destroy a few cards with a 9V battery and use those. The ideal is that each card will have a 3-colour LED on it. The colour code could be:
  • Blue: working
  • Green: done successfully
  • Red: failed
I'm going to put a few hours into learning the SD Arduino library and all the associated goodness that entails, including:
  • FatStructs
  • Sd2Card
  • Sd2PinMap
  • SdFat
  • SdFatmainpage
  • SdFatUtil
  • SdFile
  • SdInfo
  • SdVolume
Let the games begin!

[That is all]

Comments