I am trying to change the oscillator frequency of a Nano Every. I can change it from the Arduino Ide modifying the fuse byte in board.txt, now it is set at 20MHz (Fuse2 0x02).
When i Try to set the fuses from PlatformIO I receive this:
I did not change the configuration, so OSCCFG=0x01 (16MHz). It says avrdude done, but it also gives an Error 1.
The clock frequency after that is still 20MHz, so the fuses were not reprogrammed.
There is another thing that puzzles me, when i download the hex file on the 4809 I receive this message:
avrdude: 202 bytes of flash written
avrdude: safemode: Fuses OK (E:FF, H:FF, L:FF)
avrdude done. Thank you.
It gives me the value of Extended, High and Low fuses (like e.g. for ATmega328) but the 4809 has 8 fuse bytes, so what are these E:FF, H:FF, L:FF?
Hm okay so the invocation with regards to the fuses looks good, but it seems to choke on the -P usb part and it does not find a fitting USB device – likely PlatformIO invokes it in a wrong way.
What I can see when I do “Advanced → Verbose Upload” is that it does
Auto-detected: COM11
Forcing reset using 1200bps open/close on port COM11
avrdude -v -p atmega4809 -C C:\Users\Max\.platformio\packages\tool-avrdude-megaavr@1.60300.191015\avrdude.conf -c jtag2updi -b 115200 -V -e -D -P "COM11" -U flash:w:.pio\build\nano_every\firmware.hex:i
So here it does a reset-into-bootloader (?) and then uses -P "COM11".
This is likely a bug on the PlatformIO side, I’ll open an issue about it.