LeoStick Mass Storage Device

A shrunk down Leonardo-compatible board, thumb drive sized with native USB support. [Product info]
Post Reply
LukeW
Posts: 91
Joined: Tue Nov 01, 2011 10:14 am

LeoStick Mass Storage Device

Post by LukeW » Thu Feb 27, 2014 6:44 am

In the attached image you can see a quick little project I whipped up today, which might be of interest.

This uses a LeoStick as a development tool for a quick test of some code I'm developing, prior to actually developing the custom board for this project.

The LeoStick (which is modified for 3.3V operation, as you can see from the 3.3V reg at the top of the picture) is connected to an SD card, and some LUFA-based code running on the ATmega32U4 mounts this on the PC as a disk, just like your ordinary USB flash stick or SD card reader. No other hardware is needed except the SD card socket, LeoStick, 3.3V regulator and some wires and solder.

(Unfortunately this is not an Arduino sketch, it's not running from an Arduino-style bootloader, so for this sort of thing you need to overwrite the Arduino bootloader on your board with the new code, and re-flash the bootloader when you're done to restore normal Arduino-compatible functionality.)

(I like my Freetronics USBASP programmer, personally, which conveniently supports both 3.3V and 5V targets at the flick of a switch. The only slightly annoying factor is having to unplug the SD card wires from the ISP port on the LeoStick before programming, because they're only accessible at this point, not also on the main headers.)

I'm currently working on trying to get this to work on a Freetronics USBSERIAL, because moving to something like an ATmega8U2 or ATmega16U2 will reduce the BOM cost of my system, as long as the microcontroller has sufficient resources to do the jobs it needs to do. (512 bytes ought to be enough for anybody!) I have modified the code and got something that compiles with 200 bytes of RAM used, but I have not got this successfully working yet actually mounting the disk.
Attachments
IMG_1075.JPG

andrew
Freetronics Staff
Freetronics Staff
Posts: 978
Joined: Sun Jul 14, 2013 7:06 am
Location: Melbourne, Australia
Contact:

Re: LeoStick Mass Storage Device

Post by andrew » Thu Feb 27, 2014 9:24 pm

Could you please share the code anyway? We have a lot of readers who work in AVR/plain C etc.

LukeW
Posts: 91
Joined: Tue Nov 01, 2011 10:14 am

Re: LeoStick Mass Storage Device

Post by LukeW » Mon Mar 03, 2014 3:35 am

Basically, I used the code from this person:

http://www.instructables.com/id/Music-P ... h-MicroSD/

You should edit /Lib/sd_raw_config.h , and set up the pins appropriately for SPI on the microcontroller you're using, including your choice of nCS. If using a LeoStick you'll need to choose one of the ones that is exposed on the headers, and not used by, say, the internal LeoStick LEDs.

Edit the makefile, specify your microcontroller choice (atmega32u4, or whatever) and clock frequency appropriately, and set the AVR programmer type you're using (eg. usbasp) in the makefile, so you can just do a "make program" to flash the AVR.

To modify the LeoStick for 3.3V operation, we just cut the USB Power jumper on the LeoStick, and connect up a 3.3V regulator to the LeoStick headers.

On the headers on one side you've got VIN, GND, GND, 5V. VIN is 5V coming in out of your computer's USB port, so this is the regulator input, then a ground on one of the ground pins, and the output of the regulator goes to the LeoStick pin labelled "5V". This is not necessarily 5V, it's the system VCC on the LeoStick microcontroller, basically - we're making it 3.3V by cutting the jumper and adding the 3.3V regulator.

Loic
Posts: 3
Joined: Mon Apr 11, 2016 8:27 pm

Re: LeoStick Mass Storage Device

Post by Loic » Tue Apr 12, 2016 11:01 am

Hi LukeW, could you read this pls viewtopic.php?f=27&t=6571 ? ;)

Post Reply