Entering safemode in ATmega328p env

Hi all,

I use a bare atmega328p chip with atmel ICE and I sometimes hit a particular problem

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: Verify error - unable to read hfuse properly. Programmer may not be reliable.
avrdude: safemode: To protect your AVR the programming will be aborted

avrdude done.  Thank you.

*** [upload] Error 1

I was wondering what was causing this error and if disabling safemode would be a good idea. I am not sure how to do it, I was looking at documentation to see if the -u upload_flag was doing this, but I cnnot find a list of all upload_flags arguments on platformIO.

It seems to happen randomly and when it happens, the upload speed becomes very slow until I unplug the device. Here is my platform.ini env settings

[env:ATmega328P]

platform = atmelavr

board = ATmega328P

framework = arduino

upload_protocol = atmelice_isp

upload_flags = -e

upload_port = usb

; do not forget to run burn fuse task if changing values, or open a terminal ctrl+shift+p and type: C:\pathto\pio.exe run -t fuses

; The path to pio.exe can be found when running a pio command (ex build), it will print in the terminal

board_fuses.hfuse = 0xDF    ;smallest flash section size 256 since not using a bootloader with ICE programmer

board_fuses.lfuse = 0xE2    ;int 8MHz crystal (16MHz not working with less than 5V PSU)

board_fuses.efuse = 0xFE    ;BOD at 1.8V, perfect for low power