Switching between ISP and DW with Atmel ICE on Atmega328P

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!

Hi there,

I’m looking for the same thing.

@rs-development did you solve the problem?

BR

I’m in exactly the same situation, and want to switch over to using platformio and vscode. I can’t find people using the atmel ice to debug avr chips like you can in atmel studio.

Would I need to write some script for this to work, or has no one done it because avr debugging with the atmel ice is not possible outside of atmel studio?

Now it is year 2023, does the team of platformio spend some time to solve this problem?