I would like to programm and debug the ATMEGA328P with the Atmel ICE debugger. Coming from Atmel Studio i hoped this would work with VS Code and PlatformIO. But it seems to be more complicated than i thought.
debugWire can NOT be used to programm. And ISP can NOT be used to debug. To switch between those 2 fuses have to be set and cleared. The DWEN fuse.
https://microchipdeveloper.com/atmelice:connecting-atmel-ice-to-a-debugwire-target
On this page the flow is described by Microchip. It states AS takes care of the fuse while uploading and debugging an application.
I was able to upload a programm via ISP and platformIO, but how to setup the .ini file to upload with ISP, set the DWEN fuse and switch to debugWire to start debugging (which seems to be called Monitoring)? And preferably to the switchback after debugging to ISP.
Thanks for the help!