Main Site Documentation

Making CerbuinoBee a USB Mass Storage Device?


#1

I am very new to the CerbuinoBee so bare with me. Just got it all setup and LED Flash tutorial working.

So I am looking for a sample code to make the CerbuinoBee a Mass Storage Device; using the SD Card or not. I looked at most all tutorials for USB client and such, just non seem to be for the Cerbuino.

Thanks for the help!

_Jkane


#2

This is available on premium offers only.


#3

What do you mean by that?


#4

@ jkane121 - EMX, Spider, G120, ChipworkX, Ubizi

http://www.ghielectronics.com/offers

So look for the “P” in the catalogue.


#5

Ok, so the CerbuinoBee can not host the premium library?


#6

Also, is there anything I can add to the CerbuinoBee to make it be a USB MSD. I know the three ports say they are .Net Compatible?


#7

Correct


#8

What is the purpose of having an SD card slot then?


#9

@ jkane121 - you can access the sd slot from code on the bee


#10

@ jkane121 - try this

This writes a Guid to a file on the Bee every 5 seconds.

using System;
using System.IO;
using Microsoft.SPOT.IO;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
 
namespace SD_Test
{
    public partial class Program
    {
        private GT.Timer _timer;
        private string _root;
 
        void ProgramStarted()
        {
            GHI.OSHW.Hardware.StorageDev.MountSD();
            if (VolumeInfo.GetVolumes()[0].IsFormatted)
            {
                _root = VolumeInfo.GetVolumes()[0].RootDirectory;
                _timer = new GT.Timer(5000);
                _timer.Tick += new GT.Timer.TickEventHandler(TimerTick);
                _timer.Start();
            }
        }
 
        void TimerTick(GT.Timer timer)
        {
            string fileName = Path.Combine(_root, "file.txt");
            Stream stream;
            if(File.Exists(fileName))
            {
                stream = File.OpenWrite(fileName);
                stream.Position = stream.Length;
            }
            else
            {
                stream = File.Create(fileName);
            }
            using(var writer = new StreamWriter(stream))
            {
                writer.WriteLine(Guid.NewGuid().ToString());
            }
            stream.Dispose();
        }
    }
}

#11

Support for an SD is a feature of the OSHW library. USB client support for mass storage devices, which is required to make a device appear as a mass storage device to a USB host, is not support in the OSHW library.


#12

Ok Thanks Justin I will try that.

And Mike, is there any thing that will expand the Bee to be able to support Mass Storage?


#13

Direct answer: The port of MF for the Bee is open source. You can add the functionality yourself.

For most people, enhancing the firmware is a challenging undertaking. If you need the feature,
you might want to look at one of the premium offering, such as the G120HDR. The feature
is also supported in the Panda II and Spider.


#14

Thank you


#15

@ Justin - I’ve incorporated this code into the Cerbuino Bee docs… Thank you.