My Arduino Nano Every runs at 16Mhz (but the 4809 can support internal 20Mhz).
I know it may be possible to alter the boards.txt file and set it to build for 20Mhz.
However, I can't find the boards.txt for these new boards (MegaAVR).
Where is the boards.txt located?
2 Answers
In addition to set the
nona4809.build.f_cpu=20000000L
you will have to set the corresponding fuse byte to
nona4809.bootloader.OSCCFG=0x02
this enables the 20 MHz clock.
I found the boards.txt file at: ~/.arduino15/packages/arduino/hardware/megaavr/1.8.7
The Nano Every portion of the boards.txt looks like the following:
##############################################################
nona4809.name=Arduino Nano Every
nona4809.vid.0=0x2341
nona4809.pid.0=0x0058
nona4809.upload.tool=avrdude
nona4809.upload.protocol=jtag2updi
nona4809.upload.maximum_size=49152
nona4809.upload.maximum_data_size=6144
nona4809.upload.speed=115200
nona4809.upload.use_1200bps_touch=true
nona4809.upload.extra_params=-P{serial.port}
nona4809.build.mcu=atmega4809
nona4809.build.f_cpu=16000000L
nona4809.build.board=AVR_NANO_EVERY
nona4809.build.core=arduino
nona4809.build.variant=nona4809
nona4809.build.text_section_start=.text=0x0
nona4809.build.extra_flags={build.328emulation} -DMILLIS_USE_TIMERB3 -DNO_EXTERNAL_I2C_PULLUP
#nona4809.build.extra_flags=-B{runtime.tools.atpack.path}/gcc/dev/{build.mcu}
nona4809.bootloader.tool=avrdude
nona4809.bootloader.file=atmega4809_uart_bl.hex
nona4809.bootloader.SYSCFG0=0xC9
nona4809.bootloader.BOOTEND=0x00
nona4809.bootloader.OSCCFG=0x01
nona4809.fuses.file=fuses_4809.bin
menu.mode=Registers emulation
nona4809.menu.mode.on=ATMEGA328
nona4809.menu.mode.on.build.328emulation=-DAVR_NANO_4809_328MODE
nona4809.menu.mode.off=None (ATMEGA4809)
nona4809.menu.mode.off.build.328emulation=
##############################################################
If you change the following line from:
nona4809.build.f_cpu=16000000L
to:
nona4809.build.f_cpu=20000000L
Then go in and turn on verbose when you build in the Arduino IDE you will see that avrdude will pass in the following when it builds your sketch:
DF_CPU=20000000L
Will this push the CPU to 20Mhz? Not sure, but at least you know where this is now.
UPDATE
FYI - Do not set your board to 20Mhz. Especially if you have Serial Communication going on. I have software serial set up to communicate with an attached bluetooth device and when you set the CPU to 20Mhz other things are not set properly and the Serial communication fails.
-
1If the intention is to run the Nano Every at 20 MHz, you're probably better off using MCUdude MegaCoreX.– timemageAug 11, 2021 at 21:23
-
@timemage Very good point. I'm doing some different things. Using Nano Every board as a prototype. Then, I'm building the HEX file in a Arduino IDE & exporting it. I then upload it to a raw 40-pin ATMega4089 using Atmel-ICE programmer & Microchip studio. My 4089 runs on the 20Mhz internal crystal & I was trying to see if I could get Arduino IDE to generate a HEX that is using 20Mhz. Thanks again for the link– raddevusAug 11, 2021 at 21:26
-