Set Fuses to Atmega328 using Arduino as ISP

Hello everyone. I am using Arduino as ISP to program an Atmega328 U. I have a problem with the oscillator selection, because the fuses are set by default as follows: E: FFh, H: D9h, L: 62h. L = 62h means that I am using the internal oscillator and dividing the frequency by 8, therefore, the micro is working at 1MHz, I would like to modify this lfuse to make L = F0h, that way I select the external oscillator, but I can’t, because Platformio It notifies me that avrdude is using safe mode, so, I can’t change the fuse settings. How can I modify these fuses? Is there any way to disable this safe mode to edit the fuses?

I need to select external oscillator.

This is my platformio.ini configuration:


[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_extra_dirs = ./include

; change microcontroller
board_build.mcu = atmega328
; change MCU frequency
board_fuses.lfuse = 0xF0
board_fuses.hfuse = 0xDE
board_fuses.efuse = 0x05
board_build.f_cpu = 16000000L

;program via ArduinoISP
upload_protocol = custom
upload_port = COM8
upload_speed = 19200
upload_flags =
-C
; use “tool-avrdude-megaavr” for the atmelmegaavr platform
${platformio.packages_dir}/tool-avrdude/avrdude.conf
-p
$BOARD_MCU
-P
$UPLOAD_PORT
-b
$UPLOAD_SPEED
-c
stk500v1
upload_command = avrdude $UPLOAD_FLAGS -U flash:w:$SOURCE:i


After upload code, platformio says:
avrdude: safemode: Fuses OK (E:FF, H:D9, L:62)

so, line “board_fuses.lfuse = 0xF0” is not taking any effect.

I appreciate your attention and help
Best regards

Hope you’ve resolved this by now! If not, you need to specifically use the Set Fuses command. In the PlatformIO sidebar, select Project Tasks > Platform > Set Fuses.

I made a post on how to make a toolbar button for setting fuses, which might be a bit easier.