ATmega168 Xplained Mini User Guide [USER GUIDE]
42250A-MCU-02/2014
4
1. Connect the mEDBG USB to the PC.
2. Go to Atmel Studio: Tools/Device Programming, and select the connected mEDBG as Tool with Device
= ATmega168PA and Interface = ISP, click Apply. Note that if ISP programming fails it could be because
debugWIRE is enabled. See debugging chapter on how to disable debugWIRE mode:
3. Select "Memories" and locate the source hex or elf file and click Program.
4. If the source contains fuse settings go to "Production file" and upload the elf file and program the fuses.
5. To set fuses manually click Fuses and select the setting.
Recommended fuse setting:
BOOTSZ = 1024W_1C00, BOOTRST = [ ], RSTDISBL = [ ], DWEN = [ ], SPIEN = [X], WDTON
= [ ], EESAVE = [ ], BODLEVEL = DISABLE, CKDIV8 = [ ], CKOUT = [ ], SUT_CKSEL =
EXTCLK_6CK_14CK_65MS
Important
If any other cpu clk than the external clk supplied by the mEDBG is used the debugWIRE is
not guaranteed to work.
The mEDBG will prevent writing certain fuse combinations in order to protect your kit.
1.5.2
Debugging the Target Using mEDBG
Using the Embedded Debugger on the Xplained Mini board to debug the ATmega168 via debugWIRE.
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 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 ATmega168 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.
Important
If any other cpu clk than the external clk supplied by the mEDBG is used the debugWIRE is not
guaranteed to work.
1.5.3
Programming the Target Using an External Programmer
How to program the target ATmega168 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 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 = ATmega168PA, 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.