I’ve seen the post AVR Debuggen met Atmel-ICE en MPLAB X IDE onder Linux which says this error can occur if debugWire has been enabled or is in use.
What does it say when you open a PIO CLI and do
C:\Users\<user>\.platformio\packages\tool-avrdude\avrdude -v -C "C:\Users\<user>\.platformio\packages\tool-avrdude\avrdude.conf" -c atmelice_isp -p m328p
?
Other generic trouble-shooting methods would be:
- double check wiring between programmer and target chip (header orientation?)
- double check power supply of the target chip and see if it gets its 5V
- try libUSB different drivers with Zadig (see How to setup Atmel-ICE to program an ATmega328 on PlatformIO with VSCode on Windows 10 - #13 by jcsb1994)
- replug USB programmer or use another port
- try with different
-c <programmer_type>
switches in case that is wrong (which it shouldn’t though). Possible more values areatmelice
,atmelice_pdi
,atmelice_dw
,atmelice_isp