
Teensy 3.1 bare metal: Writing a USB driver (2014) - kersny
http://kevincuzner.com/2014/12/12/teensy-3-1-bare-metal-writing-a-usb-driver/
======
estebank
For anyone that might be interested, there were some efforts some time back to
get Rust running on the Teensy[1][2][3][4], and although there have been no
recent updates, the code is available to use and should still be relevant
although there have been changes[5][6][7] in the meantime.

[1]:
[https://github.com/jamesmunns/teensy3-rs](https://github.com/jamesmunns/teensy3-rs)

[2]: [https://branan.github.io/teensy/](https://branan.github.io/teensy/)

[3]: [https://disconnected.systems/blog/bare-metal-rust-on-the-
tee...](https://disconnected.systems/blog/bare-metal-rust-on-the-teensy-3.1/)

[4]: [https://github.com/SimonSapin/teensy-
clock](https://github.com/SimonSapin/teensy-clock)

[5]: [https://rust-embedded.github.io/book/](https://rust-
embedded.github.io/book/)

[6]: [https://josh.robsonchase.com/embedded-
bootstrapping/](https://josh.robsonchase.com/embedded-bootstrapping/)

[7]: [https://github.com/rust-embedded/wg/issues/40](https://github.com/rust-
embedded/wg/issues/40)

~~~
jamesmunns
Hey,

Author of the first link above. The Teensy3 crate was some of my first
embedded work, I was working with SimonSapin (author of the 4th link) at
RustFest to get something working. That library wraps some of the Teensyduino
code using bindgen, which gives you the ability to write application code
using Rust.

Overall, the Teensy 3.1/3.2 family wasn't great for developing Rust, as they
don't have debugger (SWD, similar to JTAG) lines available, meaning you have
to use the serial bootloader, and rely on a serial port for all debugging. I
believe the newer version of the board expose SWD lines now, so it's not a
problem.

Let me know if you have any questions :)

Definitely check out the embedded WG[1], and the new Rust homepage[2]

[1]: [https://github.com/rust-embedded/wg](https://github.com/rust-
embedded/wg) [2]: [http://beta.rust-lang.org/what/embedded](http://beta.rust-
lang.org/what/embedded)

------
mattnewton
Slightly off topic: I highly recommend this micro controller for projects big
and small. It packs quite a punch in terms of ram/cpu per dollar, lots of
pins, great community and Paul was really cool online and at maker’s faire.
Thank you Paul, Robin, and the rest of the community for a great product!

Off-off topic, as a web developer I love their super functional site. It even
has an about page with pictures of Paul windsurfing haha.

~~~
danellis
It doesn't seem terribly good value for money. You can get a Nucleo-32 or
Nucleo-64 for $10-15. For $23 you can get a Nucleo-144.

~~~
mattnewton
I guess I am comparing them more to arduino / adafruit replacements, rather
than more direct manufacturer prices. I have no experience with Nucleo boards
but many other boards I tried out just hadn’t no community or body of
libraries to draw from, whereas the teensy is pretty popular in the makers
community. In my case I happened to need to drive 1,000’s of LEDs in real-time
for an art piece and not only is there good software support, there is even
dedicated hardware made for the teensy for this in the Octo Ws2812 board. I
was so impressed with the quality and the size that I generally just use a
teensy LC even when a $3 trinket would probably work. YMMV

~~~
cronix
I hear you. Check out the EPS32 [1][2]. It's faster, has more mem and has
built in wifi, so you can access a webpage[3] on it via an ip and your browser
and remote control it via your phone. FastLed runs on it, and there are level
shifters similar to the Octo for it [4]. You can actually run 16 channels I
believe (vs 8 on the Octo). It uses the same level shifter (x2) as the Octo.
There is also an 8 channel available if you check the other products on
Jason's store on that Tindie site[4]. It's arduino compat- so you probably
wouldn't have to rewrite much at all.

[1]
[https://wiki.wemos.cc/products:d32:d32](https://wiki.wemos.cc/products:d32:d32)

[2]
[https://www.adafruit.com/product/3405](https://www.adafruit.com/product/3405)

[3] [https://github.com/jasoncoon/esp32-fastled-
webserver](https://github.com/jasoncoon/esp32-fastled-webserver)

[4] [https://www.tindie.com/products/jasoncoon/16-output-
wemos-d3...](https://www.tindie.com/products/jasoncoon/16-output-
wemos-d32-wifi-ble-led-controller/)

------
nayuki
The article links to a web site that has excellent information on the low-
level electrical and bit details of the USB protocol:
[http://www.usbmadesimple.co.uk/](http://www.usbmadesimple.co.uk/)

------
rwl4
Here’s a mirror for anyone interested:

[https://web.archive.org/web/20180824210333/http://kevincuzne...](https://web.archive.org/web/20180824210333/http://kevincuzner.com/2014/12/12/teensy-3-1-bare-
metal-writing-a-usb-driver/)

~~~
jonah-archive
Thanks for using us as a mirror! In case anyone who runs a CMS (HN admins?) is
wondering, we would be happy for people to hit our Save Page Now functionality
at the time of link submission, so a copy _as it was when posted_ is archived.
This is good for both having a copy of the page in case traffic takes it
offline (though in general, I think the link should go to the original since
then people get their traffic), but also in case the endpoint changes their
page or content after it's posted.

You can cause us to save a page by hitting [https://](https://)
web.archive.org/save/your-url-here with a GET request, and there are more
details about the ways to use the interface with browser plugins/etc here:
[https://blog.archive.org/2017/01/25/see-something-save-
somet...](https://blog.archive.org/2017/01/25/see-something-save-something/)

------
yodon
Looks like HN hug of death - perhaps the server is running on a Teensy?

~~~
cronix
Maybe an ESP8266 with built in wifi ;)

