Top Tweets for #tinyuf2
I have some professional projecst that effectively have this as an update requirement. i.e. The product shall be updatable with vanilla PC. There cannot be a requirement for special tools, downloaded software, drivers. We have our zephyr based bootloader to implement this (USB MSC) and also use a similar system to tinyuf2 with the ghostfat. However, firmware loads into a real file system 1st (for lots of validation, signature checks, etc). The ghostfat (ha ha, we call it zephyr 'spooky disk') is use to generate dynamic files w/ debug info (serial numbers, etc) it acutally comes out as a html or a .txt and can show the FRAM, Logs, etc. the general approach makes things really easy "in the field"
Loading firmware should be as easy as using a USB thumb drive.
If you have ever dealt with microcontroller vendor SDKs, that may sound funny and absurd, but several companies are working to make it a reality.
The first time I experienced this concept was when I used the mbed platform from Arm. They built a special development board for their online SDK that had an on board debugger chip programmed to emulate a thumb drive so you could drag-n-drop the image you downloaded in your browser after compiling. The ability to program hardware using only your browser without installing any software was very impressive. They were a little ahead of their time, and they occasionally struggled to keep their emulated drive working with constantly evolving operating systems.
Microsoft MakeCode had similar goals for ease of use, but one of their engineers, @Michal_Moskal , came up with a clever way to work around the inconsistent behavior of operating systems. He created the USB Flashing Format (UF2) that packaged the payload into specially coded 512 byte packets including details for where to store the data. Since each packet came with the location information, as long as all the packets were delivered, the complete image would be stored. This required an additional encoding step, but it accomplished the drag-n-drop programming goal more reliably than the mbed implementation.
The UF2 format worked so well, it has been adopted by others as well. Most notably, Adafruit who paired it with TinyUSB to create the open source TinyUF2 implementation, and Raspberry Pi who built it into the boot ROM of the RP2040 and RP2350 microcontrollers.
So, on a growing number of modern MCU platforms, loading firmware is as easy as using a thumb drive.

Pins on programmable devices are a precious limited resource, especially when using the smallest package due to size constraints or cost optimization. Here are a few ways to activate a boot mode without consuming additional pins.
Double Tap Reset
@adafruit uses this for many of their CircuitPython boards. If you press the reset button twice quickly, it will enter the firmware update mode. To do this you need a storage location that is not cleared by reset, like in the real-time clock (RTC). The RTC usually doesn't get reset and sometimes has general purpose storage that can be used, or you can abuse an alarm register to store the token. Main memory may be an option, but be careful to avoid locations that the ROM may use which are often not well documented. See TinyUF2 for an example.
Add a weak pull resistor to an output pin
@Raspberry_Pi does this on their RP2xxx MCUs. It looks for the SPI flash SS signal to float high at boot. If the signal is low it activates the BOOTSEL mode for firmware updates by USB. The BOOTSEL button is connected through a resistor to the SS signal to allow you to override the default pull-up. This can be done with most output pins if they can be tri-stated and are not critical at boot time.
Hold an I2C signal low
The I2C bus is open-drain so any device can pull the bus low. Both signals should be high when the bus is idle at power on. You can have code wait for this condition before continuing.
For example, if you need to multiplex debug signals, or turn off a clock that will disable the debug port, you can add this wait to your code, and then short one of the I2C signals to ground when you want to update firmware through the debug port. This has advantages over adding a delay since there is no delay when not activating the debug port and there is no race to connect the debugger before the delay expires.
How do you enable boot mode in your system? Add your suggestions to this thread.

Trends for you
Most Popular Users

Elon Musk 
@elonmusk
239.3M followers

Barack Obama 
@barackobama
118.5M followers

Cristiano Ronaldo 
@cristiano
114.3M followers

Donald J. Trump 
@realdonaldtrump
111.7M followers

Narendra Modi 
@narendramodi
106.9M followers

Rihanna 
@rihanna
98.6M followers

NASA 
@nasa
92M followers

Justin Bieber 
@justinbieber
91.7M followers

KATY PERRY 
@katyperry
89.9M followers

Taylor Swift 
@taylorswift13
83.9M followers

Lady Gaga 
@ladygaga
75.4M followers

Virat Kohli 
@imvkohli
73.2M followers

Kim Kardashian 
@kimkardashian
70.8M followers

YouTube 
@youtube
68.6M followers

Neymar Jr 
@neymarjr
66.3M followers

Bill Gates 
@billgates
65.1M followers

Selena Gomez 
@selenagomez
63M followers

The Ellen Show
@theellenshow
62.1M followers

CNN 
@cnn
61.6M followers

X 
@x
60.6M followers

