That's a pretty good idea! I figured I'd have to go hacking the uf2 boot loader. My proposal would be to click reset and hold while the boot loader cycled through 1, 2, 3.
Then, gotta pick a common memory location so the firmware can read it out.
Problem is, click and hold is a bit uncomfortable to do, at least in my opinion.
Your plan is better, but it might also be tricky because clicking again too fast would drop into boot loader. Maybe 2 seconds?
Hmm, I hadn't really thought about messing with the bootloader itself. Is it easy to work with? That would get around a lot of the limitations on this.
2 seconds is probably a safe bet. You'd have to find a comfortable window that's not so short that you risk going into the bootloader, but not so long that injecting the payload becomes a waiting game. Maybe between 2 and 4 seconds?
I haven't really worked with the ATSAMD21 much but I've got a number of projects out in the wild using the ATMEGA328P. There's a slick EEPROM library called EEPROMex that makes reading and writing values to EEPROM a breeze. I wonder if it works for the ATSAMD21...
https://playground.arduino.cc/Code/EEPROMex
EDIT: If anyone feels like testing I can provide some example code.
Last edited by MatinatorX,