Close

Firmware progress

A project log for Orthrus

SD card secure RAID USB storage

nick-sayerNick Sayer 04/17/2017 at 07:070 Comments

I spent the whole evening hacking on the firmware. With the help of a ton of online resources and looking at other folks' implementations, I got a handle on SD cards. It's not quite as easy as it might seem - particularly because there are two cards on the same bus with separate !CS lines. From a strictly SPI perspective this would seem to be a non-issue, but the problem is that SD cards are not SPI devices until you make them SPI devices, which involves sending a command with the !CS line low. Sending a command with !CS high results in that not happening. So we have to send that initial command to both cards simultaneously, which is... not really kosher, since both will drive MISO, but it can't be helped, and seems to be working ok. After that initial command forces both cards into SPI mode, the commands are repeated individually, but at this point the cards respect !CS, so everything works as expected.

Orthrus will only support SDHC or SDXC cards (at least at first). I'm not going to try to support older and smaller cards, as it's more trouble than it's worth.

The state of the code at the moment is that it will wait for you to stick two cards in, then it will attempt to prepare the volume. If the key block tests fail, the error light will turn on. Otherwise, the ready light will turn on. In either case, if you push down the button, the error light will start to blink. After 5 seconds, the volume will be re-keyed. You can pull either card out at any time and the lights will go out. You can swap the cards around and they'll still work.

Next step is to integrate this code into a LUFA mass storage driver.

Discussions