background image

 

ATmega168PB Xplained Mini User Guide [USER GUIDE]

42381A-MCU-10/2014

4

1.5

Programming and Debugging

How to program and debug the Xplained Mini board.

1.5.1

Programming the Target Using mEDBG

Using the Embedded Debugger on the Xplained Mini board to program the ATmega328 via the SPI bus.

1. Connect the mEDBG USB to the PC.

2. Go to Atmel Studio: click Tools, select Device Programming, and select the connected mEDBG as Tool

with Device = ATmega168PB 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:

“Debugging the Target Using mEDBG” on page 4

.

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

Note

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.
Trying to change CKDIV8 and/or SUT_CKSEL will be prevented and an Error message will

be displayed ("One or more registers differs").
To be able to set fuses freely the ATmega32U4 EEPROM has to be programmed to 0x00

from address 0x200 to 0x214.

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.

1.5.2

Debugging the Target Using mEDBG

Using the Embedded Debugger on the Xplained Mini board to debug the ATmega168PB 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.

Содержание ATmega168PB Xplained Mini

Страница 1: ...d The ATmega168PB Xplained Mini evaluation kit is a hardware platform to evaluate the Atmel ATmega168PB microcontroller The evaluation kit comes with a fully integrated debugger that provides seamless...

Страница 2: ...Using mEDBG 4 1 5 3 Programming the Target Using an External Programmer 5 1 5 4 Programming the ATmega32U4 Using an External Programmer 5 1 5 5 Programming the ATmega32U4 Using a Bootloader 6 1 5 6 H...

Страница 3: ...ositions J200 J201 J202 and J203 Arduino shields can be mounted 1 3 3 Standalone Node The ATmega168PB Xplained Mini board can be used as a standalone node use the 4xAAA or 2xAAA battery pack available...

Страница 4: ...W_1C00 BOOTRST RSTDISBL DWEN SPIEN X WDTON EESAVE BODLEVEL DISABLE CKDIV8 CKOUT SUT_CKSEL EXTCLK_6CK_14CK_65MS Note If any other cpu clk than the external clk supplied by the mEDBG is used the debugWI...

Страница 5: ...ing 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...

Страница 6: ...Note CKOUT must be enabled the provide clock to the target 1 5 5 Programming the ATmega32U4 Using a Bootloader This section describes how to use the bootloader to program the ATmega32U4 1 Install the...

Страница 7: ...6 Available Example Code The ATmega168PB is preprogrammed with a demo program ReMorse Source code is available in Atmel Spaces 3 When the CDC COM port is connected to a terminal window the text you wr...

Страница 8: ...ATmega168PB Xplained Mini User Guide USER GUIDE 42381A MCU 10 2014 8 Any Morse code transmitted by using the switch will be displayed as text in the terminal window...

Страница 9: ...n The ATmega32U4 mEDBG has an external 16MHz XTAL The ATmega32U4 provides an external 16MHz clock to the ATmega168PB target 2 3 Headers and Connectors The board headers and connectors 2 3 1 JTAG J100...

Страница 10: ...ailable on J104 USART header The mEDBG CDC COM port is connected to these signals Table 2 3 J104 USART Header J104 pin ATmega32U4 ATmega168PB Function 1 UART TXD PD3 PD1 TxD from ATmega32U4 2 UART RXD...

Страница 11: ...er system Table 2 7 J202 Power Header J202 pin Signal Description 1 NC 2 VCC_TARGET ATmega168PB supply voltage 3 RESET_SENSE RESET from external source monitored by the mEDBG if pulled low the target...

Страница 12: ...Board Power Supply Selection J301 pin Signal Description 1 VCC_P5V0 Board external power source as selected by J300 by default connected to VCC_BOARD via R301 2 VCC_BOARD Power supply for ATmega32U4...

Страница 13: ...can be found in the selected Extension board documentation Table 2 12 Xplained Pro Extension Header Pin Name Typical C signal Typical grid pin Extension signal description 1 ID NC Communication line t...

Страница 14: ...of Serial peripheral interface 17 SPI_MISO PB4 MISO J6 to J5 5 Master in slave out line of Serial peripheral interface 18 SPI_SCK PB5 SCK J9 to J10 Clock for Serial peripheral interface 19 GND I6 to G...

Страница 15: ...ATmega168PB pin SW200 User defined high signal press to ground negate 8 PB7 2 5 Factory Programmed Data The ATmega168PB Xplained Mini board comes with a demo program preprogrammed in the ATmega168PB F...

Страница 16: ...ATmega168PB Xplained Mini User Guide USER GUIDE 42381A MCU 10 2014 16 3 Document Revision History Document revision Date Comment 42381A 10 2014 Initial document release...

Страница 17: ...EN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves...

Отзывы: