uf2 bootloader for arduino boards

178 views
Skip to first unread message

Phillip Torrone

unread,
May 2, 2019, 4:24:58 PM5/2/19
to devel...@arduino.cc
in oct of 2018 we had met with massimo and talked about getting the uf2 bootloader on arduino boards, i am not sure if/where that request is - however the team from microsoft who made the open-source uf2 bootloader was on our show and they talked about and that reminded me to send this to the arduino developer list.

the uf2 bootloader works with all os's and shows up as a disk drive. the release binary code can be dragged onto the disk to write it. no command line, com ports, drivers required. as a bonus you can also drag the current code off the disk drive to create a backup image. it can use leds or neopixels for enumeration feedback so you know if it enumerated or not. there's also a mini html file and txt file that has version #'s and can point people to documentation.

the uf2 bootlaoder is fully-back compatible with bossa, so you can use it with all samd21 boards and it works exactly the same (yes! they squeezed mass storage alongside usb cdc and uart). so you can continue to use it with arduino ide.

microsoft wrote it for the samd21, we ported it to the samd51 and worked together for nrf52840.

=links=

one chip to flash them all:
https://makecode.com/blog/one-chip-to-flash-them-all

uf2 file format specification:
https://github.com/Microsoft/uf2

we've been using it on our boards for about 2 years now.

cheers,
pt & limor

Timon

unread,
May 2, 2019, 6:54:47 PM5/2/19
to devel...@arduino.cc
That would be tremendous. I enjoyed the mass storage feature a lot on
boards that support UF2.

It is especially great when sharing (compiled) code. Instead of have
someone download the IDE, all the needed libs, install the board support
and what not.. I can just share the .uf2 file, tell them to double press
their reset button and drag that file onto the mass storage device, done.

Andrew Kroll

unread,
May 2, 2019, 7:42:26 PM5/2/19
to Arduino Developers
Speaking of bootloaders, I've managed to fully fix the STKv2 bootloader used on the 2560 and 1280 boards.
The monitor now works properly (nobody noticed this).
The erased sector is actually the one you are writing to (known bug).
Targets for 3rd party boards now compile, but I am unable to test them.

I also some enhancements for my own use, including a hook to be able to write to flash without using a vector. Instead it uses a known per-determined location.
Is anyone interested? Anyone want to play?




--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.


--
Visit my github for awesome Arduino code @ https://github.com/xxxajk

Andrew Kroll

unread,
May 3, 2019, 5:04:09 PM5/3/19
to Arduino Developers
Found 2 more bugs in the bootloader today, and fixed them. :-)
Anyone else besides Don want to take a wack at it?
@Don I'll be sending you a new tarball shortly :-)

Andrew Kroll

unread,
May 7, 2019, 7:12:09 AM5/7/19
to Arduino Developers
I believe I have all of the bugs flushed out of the bootloader.
Enjoy.

Phillip Torrone

unread,
May 28, 2019, 5:41:36 PM5/28/19
to devel...@arduino.cc
following up!

here's something you've never seen before? - an arduino board that shows up as a disk drive, so you can drag and drop files that are stored on SD or SPI Flash over the USB connection. makes transferring assets like audio files, fonts, images, gifs, datalogs, etc as well as configuration scripts SUPER EASY! Install our Adafruit SAMD 1.5.0 board support package with TinyUSB stack support and the the example code here:
https://github.com/adafruit/Adafruit_TinyUSB_Arduino

and video!
https://youtu.be/0bWba0PU4-g

works with: SAMD21 and SAMD51 boards (also nordic's NRF52840).

cheers,
pt & limor


> On Apr 9, 2019, at 4:42 AM, PTS <timo...@gmail.com> wrote:
> +100 for this. The current state of USB on Arduino is rather frustrating.
> How exactly would you propose this transition will work? Is it backwards compatible to legacy code?


> On Tue, Apr 9, 2019, 03:58 'Phillip Torrone' via Developers <devel...@arduino.cc wrote:
> hi arduino developer list,
>
> we (adafruit) recently did a bunch of work to create an open source, cross-chip USB stack that will let anything with USB peripheral/host use the same USB CDC, HID, MIDI, MSD (etc) code. prior to this people usually hand-crafting a stack per device (based perhaps on the board support package from the vendor) or using a vendor-supplied stack that was not open source:
> https://github.com/hathach/tinyusb
>
> we're currently using this stack for nRF52840, SAMD21 and SAMD51 on CircuitPython as well as nRF52840 for Arduino. TinyUSB also has support for STM32F3 and STM32F4 as well as some popular LPCs.
>
> we propose replacing the USB stack for Arduino with TinyUSB - this would make it a lot easier to add new chipsets, and open up the peripherals available. for example, mass storage which is an oft-requested but unavailable class. we'd start with ARM chips and skip AVR's for now. it's a significant task but the USB work is done, and this would make future-versions of ourselves happy when new chips come along.
>
> please let us know if Arduino would be interested in replacing the current USB stacks with one stack.
>
> cheers,
> pt and team

Phillip Torrone

unread,
Jun 5, 2019, 1:07:19 PM6/5/19
to devel...@arduino.cc
update!

we've had more people try out the TinyUSB core with drag-n-drop mass storage + CDC with success!
https://twitter.com/cogliano/status/1136289548244115456

"Just updated my Zork emulator A2Z Machine on GitHub to support the @adafruit TinyUSB library, which allows you to easily drag and drop Z Machine files and saved games to and from the ItsyBitsy M4 Express"

"The A2Z Machine was already using the #circuitpython filesystem for storing games, but you had to go through several steps to get the files there, and required recompiling each time. #tinyusb was straight forward to implement for this project and a great addition."

https://blog.adafruit.com/2019/06/05/upgraded-zork-a2z-microcontroller-gaming-adds-drag-and-drop-game-load-cogliano-microchipmakes-retrogaming-itsybitsy-vintagecomputing-tinyusb/

we'll be adding HID support next, let us know your favorite HID descriptors and we'll try adding them as examples :)

cheers,
pt & limor

Matt Jadud

unread,
Jun 6, 2019, 10:56:22 AM6/6/19
to Developers@arduino.cc Developers
Dear all,

I want to desperately +1 this, for many educational, accessibility, and usability reasons. 

In my own teaching and research, as a faculty member, I am going to begin moving everything we do to platforms that support 1) usable and accessible, and 2) as much as possible, "driverless," devices that are 3) open and 4) have healthy community governance and 5) community contribution processes. The ability to drag-and-drop code, to develop keyboard, mouse, gamepad, and MIDI HID devices... this is invaluable. My impression is that Adafruit and the Makecode teams attempt to walk community-engaged, open source best practices in this space, and I am excited and thankful for it.

I am also intrigued by the nascent JACDAC work coming out of Microsoft and the MicroBit group (and, perhaps, others... I don't mean to fail to ack where credit is due). (https://jacdac.org/) I dislike the proliferation of incompatible physical interfaces for communication (eg. the various attempts to simplify via Qwiic, Grove, etc. when dealing with I2C, SPI, etc.) when it comes to "plug-and-play" electronics, and hope that the open/maker/educational electronics/etc. space can rally around some simple, hopefully extensible (JACDAC seems that way) protocols for a more adaptable mechanism for building small, interactive wearable/IoT/etc. systems with students, artists, researchers, and so on. The appeal of a 1-wire protocol that might use common, commodity connectors (eg. 3.5mm headphone jacks) or simplified board interfaces is, at first glance, exceedingly enticing as someone who works with students on art, music, and sensing projects on a regular basis.

I wonder if the SeeSaw could serve as a one-stop, low-cost protocol bridge from (say) I2C/SPI to JACDAC... 

Yours,
Matt


--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.

Phillip Torrone

unread,
Jun 6, 2019, 7:15:04 PM6/6/19
to devel...@arduino.cc
thanks matt!

here's an important video that bill from AT makers just posted:

Why Arduino's Mass Storage feature matters to Assistive Tech
https://youtu.be/va-EKTG5334/

cheers,
pt
> To view this discussion on the web visit https://groups.google.com/a/arduino.cc/d/msgid/developers/CAAGM456JRYYqrLZK_hHZvWhTu1p3C0D_0ydk2tgs2hNvKW6-4w%40mail.gmail.com.

kpe...@blinksoft.com

unread,
Jun 6, 2019, 7:34:08 PM6/6/19
to devel...@arduino.cc

I guess I should do a video and show the USB shield or even this Arduino Ada fruit running a braille display and a Graphiti. In time Arduino is going to make some of the devices blind people use much cheaper.

Ken
To view this discussion on the web visit https://groups.google.com/a/arduino.cc/d/msgid/developers/71AED7D7-21E0-422D-A9B0-0C9E92A90DA6%40adafruit.com.

Andrew Kroll

unread,
Jun 6, 2019, 8:29:41 PM6/6/19
to Arduino Developers
Commented in the video. Physicaloid library that actually works on my GitHub, just look for user xxxajk. Cheers.

Tyler Freeman

unread,
Jun 6, 2019, 10:02:16 PM6/6/19
to devel...@arduino.cc
This is really amazing news. Love seeing seemingly simple features, like being able to access your Arduino as a USB drive, empower a whole new community of users like people with disabilities. Great work y'all!

Phillip Torrone

unread,
Jul 30, 2019, 12:21:29 AM7/30/19
to devel...@arduino.cc
webusb is here! video:
https://youtu.be/5UU8GRoDw8c

following up on our earlier mass-storage support announcement for tinyusb:
https://groups.google.com/a/arduino.cc/forum/#!msg/developers/arldNYNsFqU/7TgECSgTBwAJ

we just added webusb support! you can now send and receive data over chrome (or other webusb) browsers with javascript or whatever else is your favorite web programming language. this can make for really interesting interactions where people don't need any drivers or software to send/receive commands, or perhaps to expose some sort of repl.

the example code is here:
https://github.com/hathach/tinyusb/blob/master/examples/device/webusb_serial/src/main.c

and here's what the webpage code looks like:
https://github.com/adafruit/Adafruit_TinyUSB_Arduino/tree/master/docs/examples/webusb-serial

we'll be adding this to our arduino library shortly, and will follow up when we have the library committed and updated.

cheers,
pt & limor

> On Jun 6, 2019, at 10:56 AM, Matt Jadud <ma...@jadud.com> wrote:
>
> To view this discussion on the web visit https://groups.google.com/a/arduino.cc/d/msgid/developers/CAAGM456JRYYqrLZK_hHZvWhTu1p3C0D_0ydk2tgs2hNvKW6-4w%40mail.gmail.com.

Massimo Banzi

unread,
Jul 31, 2019, 10:51:06 AM7/31/19
to Arduino Developers
Welcome to webusb, we added that in 2017 https://github.com/webusb/arduino/pull/33

:-)

m




--

Massimo Banzi
Co-Founder



Phillip Torrone

unread,
Jul 31, 2019, 1:13:20 PM7/31/19
to devel...@arduino.cc


> On Jul 31, 2019, at 10:50 AM, Massimo Banzi <m.b...@arduino.cc> wrote:
> Welcome to webusb, we added that in 2017 https://github.com/webusb/arduino/pull/33
> :-)

tinyUSB, in a few months is catchin' up to years of arduino.

right now we're making sure tinyUSB will be able to do everything that arduino does (and more), this way it's a drop-in replacement that does the same things, and more, and easy to use with tons of examples.

with tinyUSB there is more microcontroller support, SAMD51, NRF52840, ESP32S2, STM32, etc. in addition to webUSB, tinyUSB supports mass storage to have a file system for arduino. there are a lot of protocols to implement, if anyone on the list has protocols they'd like to see supported in tinyUSB please let us know!

this week we'll have webUSB support for the NRF52840 merged in (arduino webUSB does not seem to support NRF52840 at this time?).

we'd love to see arduino use tinyUSB!

cheers,
pt

kpe...@blinksoft.com

unread,
Jul 31, 2019, 8:39:19 PM7/31/19
to devel...@arduino.cc
I wonder if tiny usb could support the new Microsoft / apple braille display HID protocol. It would be cool to easily control a braille display by Arduino boards. I currently can control the Orbit Reader 20 braille display with a simple serial protocol but it would be better if the hid was supported.

https://www.usb.org/
Ken
--
You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.
To view this discussion on the web visit https://groups.google.com/a/arduino.cc/d/msgid/developers/A381B3B6-44A3-4053-88E8-603148AEBA19%40adafruit.com.

PTS

unread,
Aug 1, 2019, 6:10:23 AM8/1/19
to devel...@arduino.cc
Bi-directional Raw HID is already supported, it shouldn't take more than a small descriptor change to enable this, although I'm not sure if it works in host mode if that's what you mean.

kpe...@blinksoft.com

unread,
Aug 1, 2019, 6:18:58 AM8/1/19
to devel...@arduino.cc

It would have to be in host mode. 

Phillip Torrone

unread,
Aug 1, 2019, 12:57:34 PM8/1/19
to devel...@arduino.cc
hi ken,

is this the device? we can purchase one and see if we can get that working:
https://tech.aph.org/or20/

cheers,
pt & limor
> To view this discussion on the web visit https://groups.google.com/a/arduino.cc/d/msgid/developers/001e01d54801%248c2c5360%24a484fa20%24%40blinksoft.com.

kpe...@blinksoft.com

unread,
Aug 1, 2019, 1:35:14 PM8/1/19
to devel...@arduino.cc
Yes it is but before you buy one send me an email at kpe...@blinksoft.com
To view this discussion on the web visit https://groups.google.com/a/arduino.cc/d/msgid/developers/EA46CDA7-C779-4573-A300-CCA41A6E12F5%40adafruit.com.

Phillip Torrone

unread,
Aug 6, 2019, 6:34:06 PM8/6/19
to devel...@arduino.cc
ok!

here's some more fun stuff!

webusb with arduino using circuit playground express / tinyUSB. now released for SAMD & nrf52840 core:
https://github.com/adafruit/Adafruit_TinyUSB_Arduino/tree/master/docs/examples/webusb-rgb

video:
https://youtu.be/a4VycN6ey30

next up! firmata!

cheers,
pt
Reply all
Reply to author
Forward
0 new messages