7.2.2 Debugging the ATmega328PB Xplained Mini By Using mEDBG

  1. Start Atmel Studio.
  2. Connect the mEDBG USB to the PC.
  3. Open your project.
  4. In the Project menu, select the project properties page. Select the Tools tab, and select mEDBG as debugger and debugWIRE as the interface.
  5. In the Debug menu click Start Debugging and Break.
  6. Atmel Studio will display an error message if the DWEN fuse in the ATmega328PB is not enabled, click YES to make Studio set the fuse using the ISP interface.
  7. A debug session is started with a break in main. Debugging can start.
  8. When exiting debug mode select Disable debugWIRE and Close in the Debug menu. This will disable the DWEN fuse.
Note:
  1. If the debug mode is not exited by selecting Disable debugWIRE and Close in the Debug menu, the DWEN fuse will be enabled and the target will still be in debug mode, i.e. it will not be possible to program the target by using the SPI (ISP) interface.
  2. The bootloader code supplied with this application note has been optimized for size and hence it may not be possible to do debugging. Removing the optimization will increase the code size and it may not fit into the bootloader section. Hence it is recommended to use only the programming mode.