ATmega168PB Xplained Mini User Guide [USER GUIDE]
42381A-MCU-10/2014
5
5. In the Debug menu click Start Debugging and Break.
6. Atmel Studio will display an error message if the DWEN fuse in the ATmega168PB 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
If not exiting debug mode 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 using the SPI.
Note
If any other cpu clk than the external clk supplied by the mEDBG is used the debugWIRE is not
guaranteed to work.
Note
Applying a signal to J202/RESET (the RESET_SENSE signal) while debugging may result in
unexpected behaviour. This signal is NOT available during a debugging session because the
RESET line is actively used by the debugWIRE interface.
1.5.3
Programming the Target Using an External Programmer
How to program the target ATmega168PB using the AVR
®
JTAGICE mkII, JTAGICE3, or other Atmel
Programmers.
1. Connect the External Programmer to the PC.
2. Connect the External Programme to the evaluation board ISP connector (J204) (Need the 6-pin 100mil
adapter connected to the JTAGICE).
3. Go to Atmel Studio: Tools/Device Programming, and select the External Programmer connected as Tool,
Select Device = ATmega168PB, Interface = ISP and click Apply.
4. Select "Memories" and locate the source hex or elf file and click Program.
5. If the source contains fuse settings go to "Production file" and upload the elf file and program the fuses.
Recommended fuse setting:
BOOTSZ = 1024W_1C00,
BOOTRST = [ ],
RSTDISBL = [ ],
DWEN = [ ],
SPIEN = [X],
WDTON = [ ],
EESAVE = [ ],
BODLEVEL = DISABLE,
CKDIV8 = [ ],
CKOUT = [ ],
SUT_CKSEL = EXTCLK_6CK_14CK_65MS
1.5.4
Programming the ATmega32U4 Using an External Programmer
How to program the ATmega32U4 using the AVR
®
JTAGICE mkII, JTAGICE3, or other Atmel Programmers.
To restore the mEDBG FW use the /tools/mEDBG/mEDBG_fw.zip from the Studio installation.