Jump to content

[Version 1] Teensyduino 0.9 Alpha Test (usb Disk)


Recommended Posts

Any ideas of the eta on the MicroSD boards? :)

A Teensy form factor adaptor is in the works. It's very small, less than half the size of the Teensy itself, pretty much just the size of the Micro SD card itself plus the first 5 pins on the top and bottom of the Teensy. A first proto was made last week, just to get access to the Micro SD card pins, but without any 5 to 3 volt circuitry. Second proto is in fab now, and parts to build it just arrived a couple days ago. If that works, properly manufactured boards at low price (likely about $7) should be available in late May.

Of course, you could always build your own, or buy one ready-made....

http://www.instructables.com/id/Cheap-DIY-...adboard-socket/

http://store.gravitech.us/micaad.html

Do keep in mind the SD cards need 3.3 volts. Using a 3.3 volt regulator and a 5 to 3 volt buffer (eg, 74LCX125) is the best option. You can also mod the Teensy to run at 3.3 volts, though running at 16 MHz and 3.3 is technically overclocking.

http://www.pjrc.com/teensy/3volt.html

Software support should begin to appear in a couple weeks. I've used SD cards before in several projects, so I have plenty of code laying around. Then again, I haven't used the relatively new SDHC cards yet (other than plugged them into my camera), so it'll need some tweaking. Also, there are some challenging low-level issues I'm concerned about. The main one is achieving close to 1 Mbyte/sec speed, at least for reading, but hopefully while writing too. Since the USB packets are 64 bytes and are handled in an interrupt driven driver (which is how I'm making it integrate so nicely with Arduino), it's going to take some tricky state machine logic to manage the card's state. When I start putting in the ability to access the card through a filesystem layer from your code on the Teensy, some tricky locking and media access management is going to be needed, down to the lowest levels. I imagine that is going to take time to write and debug.

So, like all software, who knows how long it'll take?! There will be lots and lots of bugs releases, I'm sure.

While I'm really more focused on apps like data logging, really from a technical point of view, the Ducky project is a great test because raw media access to USB with little or no media support (yet) from the Teensy-based code is actually useful. (though to be honest, I'm not a networking or security guy and I do hope everyone here is using this stuff responsibly) Really, user feedback, and especially well written bug reports, really, really help. So if you're jonesing for Micro SD card support but not into low level device driver coding, even just trying out the existing code and keeping a watchful eye for anything strange really helps.

For the next few days, I'm going to take a little break from SCSI commands and sense codes, USB mass storage bulk only transport protocol, FAT filesystem, and worrying about individual bytes and instruction cycles! I do most of this coding in C+asm and then bring it over into Teensyduino once it's stable. Using Arduino again reminded me of its bugs that really annoy me. I put them on my to-do list, so I think I'm going to take a few days off and do relatively easy java coding to fix those damn Arduino bugs!

Edited by Paul Stoffregen
Link to comment
Share on other sites

Alpha #2 uploaded.

Most changes are bug fixes and changes in the Arduino tools menu. The installer looks the same, but got a major rewrite so it can install to any supported Arduino version. I somehow broke 0016 on Windows (and whatever java exception isn't being thrown to the console, so I can't figure out why.... windows, grrrrr) so only 0017 and 0018 will install. On Mac and Linux, 0016 to 0018 install.

http://www.pjrc.com/teensy/experimental.html

Still broken on USB Disk is using Serial.print() and having the board automatically reset, so you don't have to push the reset button. Those are up next, then I'm going to tackle SD/Micro-SD card support.

Please give the "Disk(internal) + Keyboard" option a try from the new Tools->USB Type menu! If you discover a bug, please tell me. Or even if it works fine, wouldn't hurt to post here with a "works for me".

Link to comment
Share on other sites

Alpha #3 uploaded.

So far, not even one single person has replied or emailed with any feedback on actually using these new versions.... why not be the first?

Also, does anyone know a way to temporarily disable the Windows safe to remove hardware balloon notification? That's temporarily, like for the fraction of a second before calling the WIN32 function CM_Request_Device_Eject() as soon as it's done?

This whole process is painfully slow in XP (like an extra several seconds longer than Linux and MacOS, and sometimes very slow, like 15+ seconds), so I'm searching for ideas to speed it up!

Link to comment
Share on other sites

USB Disk: using internal flash memory (Teensy = read-only, Teensy++ = read/write)

sounds awesome, any furthur details, hwo to enable / use etc.?

the only ballon tip thing I know is:

[start] [Run] [Regedit]

Registry Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced

Modify/Create the Value Data Type(s) and Value Name(s) as detailed below.

Data Type: REG_DWORD [Dword Value] // Value Name: EnableBalloonTips

Setting for Value Data: [0 = Balloon Tips Disabled / 1 = Balloon Tips Enabled]

Exit Registry and Reboot

might want to test to see if it actually does need rebooting tho... not all regedits do

Edited by NanoyMaster
Link to comment
Share on other sites

USB Disk: using internal flash memory (Teensy = read-only, Teensy++ = read/write)

sounds awesome, any furthur details, hwo to enable / use etc.?

Just choose it from the menu and click the upload button.

I added a new "USB Type" sub-menu inside the Tools menu, because putting both the board and usb type inside Tools->Boards was getting to be a long list. Also, many people (probably those with a lot of experience with normal Arduino boards) don't ever notice there's more than 1 choice for their board. Hopefully having the usb type in its own menu will improve usability.

My goal is to make it very easy to use. The build process copies files from a specific directory to populate the filesystem on your freshly uploaded USB disk. If that directory doesn't exist, I coded it to give you readme file that tells you where that directory needs to be. At least it's supposed to be easy. If something's not obvious, please tell me. It's hard to anticipate how people will experience this stuff for the first time while being so deeply buried in the fine details.

might want to test to see if it actually does need rebooting tho... not all regedits do

I'll give that a try, though I might not do much more on this windows-wise for a couple weeks. I'm probably going to focus on the SD card support and the filesystem layer, so people can build more interesting apps like data logging. I always develop on Linux and then port to Mac and Windows. I even compile the .exe files on linux using mingw in cross compiler mode. My windows test system got all messed up, yet again, and needs another reinstall... buy probably not for a couple weeks.

Link to comment
Share on other sites

ok, kewl... I guess I'll have to play :D

hopefully code can manipulate the space, just thinking aloud:

counter - counts how many boxes you pwn,

polymorphism - no real applicable reason other than "just because you can"

could store trojan + crypter/packer to encrypt with license key to evade av

store anything for more convenient viewing

I'm sure other people here can come up with a lot more creative ideas..

as I said, just me thinking out loud.

be cool if someone makes any of these. I might when I have more time, but doesn't look like it'll be any time soon

Link to comment
Share on other sites

would it be possible to add a USB-CDROM feature for the teensy to mount iso files?

Possible, yes.

Easy, no.

Likely, not very ... at least as part of Teensyduino, where you can just click it in a menu and everything is done for you very automatically.

so you can boot from the teensy?

Until SD card support exists and is stable, I wouldn't even consider this. The internal memory just isn't large enough to hold any meaningful PC or Mac boot code. With 12 Mbit/sec USB, you're never going to see over about 1 Mbyte/sec. Maybe speed equivalent of 6X cdrom drive might be useful for some applications?

There is a guy who made a CDROM emulating device using Dean Camera's LUFA library. He has since moved to the more powerful (and complex) AVR32 chip which has 480 Mbit/sec USB. But here's his website.

http://cdemu.blogspot.com/

http://renosite.com/cdemudetails.html

I do not believe he's published any code, but you could probably ask a question or two.

If your goal is simply to boot, is a full CDROM (scsi type 5) emulation with ISO9660 filesystem really necessary? There is a USB mass storage bootability spec, which honestly I haven't looked into much (yet). Would booting be possible as a scsi block device with those features implemented? (hint, the answer involves going to usb.org and carefully reading the mass storage class specs....)

Link to comment
Share on other sites

theese are bad bad news :)

but btw.: sd card support works and i tested it with masstorage/HID kombination.

its perfect to have the executable and the keystrokes on the same stick to let your magic happen ;)

http://elasticsheep.com/2010/04/teensy2-us...ith-an-sd-card/

for LUFA there is a masstorage / dataflash example which turns the teensy to a readonly 20kbyte usbstick with HID support. very good to deliver payloads if you have just the teensy.

Link to comment
Share on other sites

I've got it working now in read-only mode, working on being able to write to the card.

sd_project_15may10.jpg

That tiny board in the center of the top breadboard is the Micro SD adaptor, which includes a 3 volt power supply and 5 to 3 volt buffers, so the Teensy can run at full speed. Those boards will probably sell for about $7. It's meant to solder to the first pads on the Teensy, just over the top of the USB connector. At first there will be a very limited production of these boards, probably about 20 pieces, likely within the next week or two. They'll be manufactured in quantity by the end of June.

I still have a lot of work to do on the software side, at least for people wanting to use this for projects where their own code does something more than sending HID keyboard data. Heavy access from the PC hogs the Teensy CPU time, sometimes starving other interrupts, but i have a plan for that. I'm also planning a locking layer for sharing the hardware, and of course filesystem drivers.... so much coding to do!

But soon a new alpha version will be out, which at least makes the card available to the PC.

Link to comment
Share on other sites

Quick update... I've got the SD/SDHC card stuff working, except media removal and insertion isn't being properly reported to windows. Mac and linux are perfectly happy with my scsi sense keys, but not windows. I'll get it figured out soon. Tonight I hooked up a regular card reader to my protocol analyzer... but it's one of those many-in-one types that windows detects as 3 drive letters, so there's a lot of extra traffic that's confusing to sift through. Tomorrow I'm going to go buy a SD-only card reader and watch how it reports this stuff. There's gotta be some tiny detail that matters for windows, but linux and mac manage just fine.

Reading and writing the card does work fine in windows, and mac and linux with the code as it is. If I don't get this last bug fixed soon, I'll probably make a release with it and if you pull the card, well, just unplug the whole cable to let windows know it's not there. Hopefully I'll figure this out so nobody will have to do that.

Here's a picture of the adaptor soldered onto a Teensy.

micro_sd.jpg

Maybe you're wondering when you can actually get one of these? There will be 15 pre-production boards built later this week, and another 15 next week. I'll post a link in the next few days when these can actually be ordered. Just subscribe to this thread if you want to be notified. These pre-production boards will be available on a first come, first serve basis at $10 each. Please, if you're not planning to actually use it right away, please wait for the production boards (and save yourself a few dollars). The hardware is simple, but the supporting code is quite complex, so everybody will benefit if the people who get these first pre-production boards can use them and report any bugs. Sometime between the middle to end of June the production boards will be ready. Those will likely sell at $7, maybe even $6 each. There will be plenty to go around!

Link to comment
Share on other sites

I'm going to add this to the Teensyduino 0.9 alpha, so it will just work automatically if you select it from the Tools->USB Type menu.

There are also a few different Arduino libraries (of varying capability and quality) for accessing the SD card. For now, if you want your code to actually access the card, you'll need to use one of those. In time, I'm going to build similar code into Teensyduino (with features to manage if the USB or your code has access to the card), so a separate library won't be needed. That's going to take time to write and test, but it is coming.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...