Note that the Nano Every specifications currently show a clock frequency of 20MHz, but the board actually runs at 16MHz.
Fortunately, this can be easily changed by modifying the boards.txt file.
The Nano Every uses the internal PLL as a clock, rather than an external crystal. The maximum speed is 20 MHz, but, as you discovered, the board definition was configured by Arduino to run at 16 MHz.
I was told that you can change it to run at 20 MHz by simply changing:
That seemed strange to me because the megaAVR 0-series datasheet says of the OSCCFG fuse in section 188.8.131.52:
You can see that the OSCCFG fuse is set to 0x01 right there in boards.txt:
maybe there is some mechanism in the core code for adjusting it purely based on the value of F_CPU, but I haven't seen anything like that. My suspicion is that you also need to change that line to:
to make it run at 20 MHz. After that, it appears you can just do a standard upload to set the fuses, rather than having to do a Burn Bootloader as we must on the standard AVR boards.
I haven't gotten a Nano Every yet so I haven't been able to try it out myself. Let me know how it works for you.
If you want to be able to change clock speed from the IDE append the following to the atmega4809 section of the boards.txt file:
Direct port manipulation is very different from other Arduino boards, so any code that depends on that may need to be modified.
I have seen some discussion indicating the program memory and dynamic memory are in the same address space, so it isn't necessary to use PROGMEM to put constants in program memory. This appears to be correct, as serial.print() statements without the F() parameter do not increase the amount of dynamic memory used.