Teensy acting as USB memory stick?

Status
Not open for further replies.

gwideman

Well-known member
Hi all,
I'm wondering what would be involved in getting Teensy to act as a USB memory stick, possibly for only a portion of the time it's attached to a host. Something along the lines of this project: https://www.tindie.com/products/matrixstorm/avr-stick-prototype/

First off, is there a library that already implements this?

Part of the motivation would be to enable copying config files to the Teensy on the fly from the host OS.

-- Graham
 
First off, is there a library that already implements this?

Teensy 2.0 has this. Select it from the Tools > USB Type menu.

You can use either SD card or the internal flash as the storage media. Only Teensy++ 2.0 can write to its flash. But support read/write access when using a SD card.

Part of the motivation would be to enable copying config files to the Teensy on the fly from the host OS.

Well, that's much harder. Sharing the media between the USB and Teensy is difficult and kludgey at best. There are some undocumented functions in the code to help, but they don't work very well (there's a reason they were never documented).

It's the reason this code hasn't been ported to Teensy 3.x. You can act as a USB disk, but you can't easily share the disk between the PC and Teensy.

I am planning to redo all this stuff with the newer and much better MTP protocol, sometime in 2015. But that is an incredible amount of work, so it's not going to happen overnight.
 
Hi Paul, Thanks for the reply! I had not noticed the Tools > Disk setting cuz I was so eagerly playing with newly arrived Teensy 3.1. Thanks for the suggestions and comments on readiness for prime time :).
-- Graham
 
Teensy 2.0 has this. Select it from the Tools > USB Type menu.

You can use either SD card or the internal flash as the storage media. Only Teensy++ 2.0 can write to its flash. But support read/write access when using a SD card.



Well, that's much harder. Sharing the media between the USB and Teensy is difficult and kludgey at best. There are some undocumented functions in the code to help, but they don't work very well (there's a reason they were never documented).

It's the reason this code hasn't been ported to Teensy 3.x. You can act as a USB disk, but you can't easily share the disk between the PC and Teensy.

I am planning to redo all this stuff with the newer and much better MTP protocol, sometime in 2015. But that is an incredible amount of work, so it's not going to happen overnight.



Does this mean I could use a teensy 2.0 (or teensy 2.0++) to log data to an SD card then access the SD card from a computer via usb?

I was under the impression that was nearly impossible. (something that Paul describes as "difficult" is something that that I consider "impossible")

If this is possible (and by "possible" I mean not difficult), is there anywhere I can read more about it? I don't even see "usb type 'disk (SD Card) + keyboard'" on the PJRC "code library" page.
 
Hey Paul, any status on your work on this Teensy 3.x MTP project?

It got put on hold these last few weeks while working on the audio workshop & tutorial for the Hackaday Supercon. A good tutorial for the audio library has been lacking for a long time, so this seemed like a worthwhile pursuit, even if it delayed other stuff.

I'm going to get back to the MTP stuff next week. We need it to release the upcoming Prop Shield, so look for real progress soon.

With all these new features, lack of people willing to test the pre-release code from github limits the speed of development. If you're willing to give the very early code a try and post detailed feedback, it'd be really helpful.


If this is possible (and by "possible" I mean not difficult),

It's definitely difficult.

is there anywhere I can read more about it? I don't even see "usb type 'disk (SD Card) + keyboard'" on the PJRC "code library" page.

No, there's no documentation. I basically abandoned this effort, since it only kind-of worked with Linux and failed miserably with Windows (which seems to second guess the SCSI sense codes). There's some stuff buried deep within the source code, like "claim" and "release" (meant to user-level, long duration media management) and lock/unlock meant for short duration management of interrupts. Honestly, this stuff is on the pretty far end of difficult.... to the point I decided to abandon the effort. That's why no documentation exists.

With MTP, I intend to do much better and make things as easy as I can.
 
With MTP, I intend to do much better and make things as easy as I can.

Windows & Linux native support for MTP is good enough; I'm just wondering if you've seen a good solution for OS X MTP support?

I'm willing to test pre-release code. At the moment I can only see your "Begin work on MTP Disk" commit on the 3rd October; is it worth me trying this out to see if my computers (windows & OS X) can recognise the MTP device?
 
No, there's no point testing the current code. I'll put a call out when there's something ready for testing and feedback.
 
Status
Not open for further replies.
Back
Top