Encrypted USB stick with atxmega128a3u
Stephan Bärwolf's AVR stick is a wonderful device to play with: it is a breakout of sorts for ATMEL's atxmega128a3u chip, and I like how it is designed:
- It comes in a USB stick format (5cm x 2.5cm).
- It has a powerful 3.3V regulator (500mA), so even power-hungry peripherials (like a microSD) have enough juice.
- While it doesn't expose all the xmega's pins (there's too many of those), it breaks out the interesting ones - the ones that connect to xmega's modules, e.g. serial, I2C, SPI, JTAG, DAC.
- atxmega128a3u is a powerful chip (compared to AVR8 chips that are usually used in AVR devices like Arduino): it runs fast (32MHz), big flash space (128kB), lots of USB endpoints (so one can have many USB "devices" at the same time), crypto module (AES128 is fast), digital-to-analog converter (so that one doesn't have to fiddle with PWM). The disadvantage is that it's XMEGA architecture, so one needs to use avr-gcc directly and there's less libraries compared to AVR8/Arduino.
I wanted to make the AVR stick into an encrypted mass storage stick. At the moment I don't have any extra storage attached to it (no microSD or dataflash), so I only use the xmega's flash space as storage. This is really not a good way of doing things, since atmel chips' flash has a really limited number of writes (on the order of thousands), and of course it's small (for a mass storage device).
Nevertheless, I've succeeded. Firmware/sources here, using avr-gcc. The stick enumerates as a composite (Serial+MassStorage) device. Upon connecting to the Serial, one can enter a passphrase, which is then used for decrypting the 64kB image, which then appears as an ordinary Mass Storage to the PC.
The whole thing is possible only because Stephan has written a great bootloader for the xmega, which allows to write to xmega's flash from the firmware itself (this is normally not possible, and writing to flash can be done only from the bootloader, during regular flashing of a new firmware). More info about this is on Stephan's AVR stick page, look for "apipage example".
The USB communication uses the wonderful LUFA library.
The next step is to attach a microSD card to the AVR stick and use it for storage, instead of xmega's flash.