Sketch that reads the unique id of a 'Nano Every'

Is it possible for a sketch to read the unique ID (Or serial number) of 'Nano Every'?

I have played with the ArduinoUniqueId library and can get the code to read an ID but as the 'Nano Every' is not in the list of supported device, I am not sure if the value returned is actually related to the serial number.

Thanks

Hi @hangstrap.

The serial number shown in the "Board Info" dialog comes from the ATSAMDG11 chip on the board that acts as the USB interface, not from the ATMega4809 on which the sketch program runs.

Thank you - I have updated my post with this information. Is it possible to read the ATSAMDG11 USB chip's serial number from a sketch?

After a quick look, it appears that the library.properties file has not been updated to reflect that the library code does in fact support MegaAVR chips such as the 4809 as used in the Nano Every. Not that that gets you any closer to being able to access anything about the USB chip from a sketch. For that I suspect you'd need something akin to a UPDI programmer sketch and an adapter board with pogo pins to access the SAMD's programming header.

I don't know for certain, but I'm doubtful it would be possible to do with the stock ATSAMD11 firmware the Nano Every ships with. The firmware would need to provide some way to recognize a query from the ATmega4809 and respond with the serial number.

But I think that in order for the forum helpers to provide you with effective assistance, it will be important for us to understand exactly what you need the unique ID for. If you only need any unique ID, then the one provided by the ATmega4809 will be fine, even if it isn't the board's serial number. Or is there some reason you want to obtain the serial number specifically?

There is some information on flashing the ATSAMD11 on the Nano Every here:

And, on a related subject, instructions for setting up Arduino IDE support for the ATSAMD11 and compiling the "MuxTO" firmware here:

Unfortunately there has been some bit rot since the time those instructions were written and the tool dependencies provided by the 3rd party "MattairTech SAM D|L|C core for Arduino" package used in the "Install toolchain" section of those instructions are no longer available

Thanks for the help. I just need a unique ID - not the one supplied by the USB chip. So the one produced by the ArduinoUniqueId will be fine.