Using Atmel-ICE For AVR® Programming in Mass Production: Application Note
Using Atmel-ICE For AVR® Programming in Mass Production: Application Note
Using Atmel-ICE For AVR® Programming in Mass Production: Application Note
Introduction
For mass production, it is recommended to use dedicated production programmers that are designed to
operate in production environments and which have software intended for volume production. The
®
application note “AT06015: Production Programming of Microchip AVR and SAM microcontrollers” lists
rd
3 party production programming tools for both Microchip AVR and SAM microcontrollers.
® ®
The Atmel-ICE is a powerful development tool for debugging and programming AVR and ARM Cortex -
M-based SAM microcontrollers. Though the Atmel-ICE is not intended for production programming, some
users choose to use it for small-scale production programming because it is very affordable, and because
it is already well known from the development phase of the product. To speed up the development of the
user's production programming tool, this application note gives a detailed introduction to the Atmel-ICE
setup, driver installation, user guide of the Atmel-Studio command line utility (atprogram.exe), and a PC
programming tool project written in C#. The Visual C# example project can be downloaded along with this
application note and run with the ATmega328PB Xplained Mini kit.
Features
• Atmel-ICE introduction
• “atprogram” utility user guide
• Example mass production programming tool development
Table of Contents
Introduction......................................................................................................................1
Features.......................................................................................................................... 1
1. Atmel-ICE Introduction.............................................................................................. 3
1.1. Atmel-ICE Features......................................................................................................................3
1.2. Atmel-ICE System Requirements.................................................................................................3
1.3. Atmel-ICE Kit Contents................................................................................................................ 4
1.4. Assemble Atmel-ICE.................................................................................................................... 4
1.5. Connecting to the Host Computer and USB Driver Installation....................................................6
1.6. Software Integration in Atmel Studio............................................................................................ 6
4. References.............................................................................................................. 18
5. Revision History.......................................................................................................19
Customer Support......................................................................................................... 20
Legal Notice...................................................................................................................21
Trademarks................................................................................................................... 21
1. Atmel-ICE Introduction
Atmel-ICE is a powerful developing and programming tool for the ARM Cortex-M-based SAM and AVR
microcontrollers. It supports:
®
• Programming (TPI) of all tinyAVR 8-bit microcontrollers with support for this interface
®
• Programming and on-chip debugging of all AVR XMEGA family devices on both JTAG and PDI 2-
wire interfaces
• Programming and on-chip debugging of all AVR UC3 microcontrollers on both JTAG and aWire
interfaces
• Programming (JTAG and SPI) and debugging of all AVR 8-bit microcontrollers on both JTAG and
debugWIRE interfaces
• Programming and debugging of all SAM ARM Cortex-M-based microcontrollers on both SWD and
JTAG interfaces
For most purposes, the 50-mil 10-pin IDC flat cable can be used, connecting either natively to its 10-pin
or 6-pin connectors, or connecting via the adapter board, as shown in the figure below. Three adapters
are provided on one small PCBA. The following adapters are included:
• One 100-mil 10-pin JTAG/SWD adapter
• One 100-mil 20-pin SAM JTAG/SWD adapter
• One 50-mil 6-pin SPI/debugWIRE/PDI/aWire adapter
Figure 1-3. Atmel-ICE Adapter
To assemble your Atmel-ICE into its default configuration, connect the 10-pin 50-mil IDC cable to the unit,
as shown in the figures below. Be sure to orient the cable so that the red wire (pin 1) on the cable aligns
with the triangular indicator on the blue belt of the enclosure. The cable should connect upwards from the
unit. Be sure to connect to the port corresponding to the pinout of your target, AVR or SAM.
Figure 1-4. Atmel-ICE AVR Probe Connection
Examples:
• atprogram -t samice -i jtag -d atsam3s4c chiperase
Perform chiperase on ATSAM3S4C.
• atprogram -t atmelice-i ISP -d atmega328pb chiperase
Perform chiperase on ATmega328PB.
-ee --eeprom: Write to EEPROM. tinyAVR, megaAVR, and AVR XMEGA only.
-us --usersignature: Write to user signature.
-fs --fuses: Write to fuses.
-lb --lockbits: Write to lockbits.
--values (value): Hex encoded values to write, e.g.: 0102040A0F.
-o --offset (offset): Values are written from this offset.
-v --verify: Verify memory contents after write.
Examples:
• atprogram -t atmelice -i ISP -d atmega328pb write -lb --values c0
Write value 0xc0 to ATmega328PB chip fuse lockbits.
3.1 Prerequisites
The programming tool example discussed in this document requires:
• Atmel Studio 7.0 or later
• The example AVR_massproduction_programming_tool_with_atmelice.zip file downloaded from the
Microchip website
®
• .Net framework 4, which can be downloaded from the Microsoft website
• Microsoft Visual C# 2010 Express or later
• 1 set of Atmel-ICE full kit
• 1 set of ATmega328PB Xplained Mini kit, as shown in the figure below
Figure 3-1. ATmega328PB Xplained Mini Kit
3.2 Features
• One button click to start the chiperase. The firmware image will then be programmed and verified,
and the fuse lock bit will automatically be written.
• Output programming result information - pass or fail
• Real-time display programming output information
• Image and atprogram.exe file path selection
The detailed steps on how to use this tool are listed below:
• Step 1: Download the AVR_massproduction_programming_tool_with_atmelice.zip file from the
Microchip website and unzip it. After unzipping, it will have two folders; one is the
Mass_production_programming_tool and the other is atprogram_example_application_project. In
the mass_production_programming_tool directory, you will find the tool application and example
firmware image file Button_led.hex, which can run on the ATmega328PB Xplained Mini Kit. The
atprogram_example_application_project directory contains the source project developed with
Visual C# 2010 Express.
• Step 2: Connect the Atmel-ICE kit to the ISP programming port of the ATmega328PB Xplained Mini
Kit with a 6-pin 100-mil IDC flat cable as shown in the figure below.
Figure 3-3. ATmega328PB Xplained Mini Kit's ISP Connection with Atmel-ICE
• Step 3: Plug the Atmel-ICE kit's USB cable into the PC and launch the
mass_production_programming \Atprogram_application_example.exe application from the directory
where you unzip the AVR_massproduction_programming_tool_with_Atmelice.zip file.
• Step 4: Click the "Atprogram selection" button in the programming GUI window and choose the
Studio command line utility "atprogram.exe" file path. The atprogram.exe is located in the Atmel
Studio installation directory \atbackend.
• Step 5: Click the "FW file selection" button in the programming GUI window and choose the
"Button_Led.hex" file from the directory where you unzip the
AVR_massprodcution_programming_tool_with_Atmelice.zip file.
• Step 6: Click the "Program" button. The "programming" string in program_status textbox will show
up, as shown in the figure below.
Figure 3-4. ATmega328PB Chip In-programming Status Display
• Step 7: Once programming is finished, it will show either the "success" string, as shown in figure
ATmega328PB chip programming success info display, or the "fail" string, as shown in figure
ATmega328PB chip programming failure info display, in the program_status textbox. If device
programming fails, the users must first check the connection between Atmel-ICE and
ATmega328PB Xplained Mini Kit's ISP programming connector; secondly, the users must check the
ATmega328PB chip in the ISP programming mode because the kit programming mode may be
changed from default ISP mode to debugWire mode. For ATmega328PB chip programming mode
selection, refer to the AN42469: ATmega328PB Xplained Mini kit user guide.
Figure 3-5. ATmega328PB Chip Programming Success Info Display
• Step 8: Verify if the example firmware image Button_led.hex is programmed successfully into the
ATmega328PB Xplained Mini kit. Once successfully programmed, LED0 will be ON when the SW0
mechanical button is pressed and OFF when the SW0 button is released.
// Program firmware image file assigned by text of textBox2 to flash and verify after
programming
reader = RunProgram_atprogram("cmd.exe", "atprogram -t atmelice -i ISP -d atmega328pb
program -f "+textBox2.Text+" --verify",textBox1.Text);
.................
// Writing fuse lock bits value-0xc0(The fuse lock bits value need refer to specific device
datasheet, 0xc0 just for ATmega328PB device )
reader = RunProgram_atprogram("cmd.exe", "atprogram -t atmelice -i ISP -d atmega328pb write -
lb --values c0 ", textBox1.Text);
.................
As the example software tool is developed for ATmega328PB device programming with ISP interface, the
user must replace the device name (ATmega328PB) and programming interface name (ISP) with those
on the user's platform. After modification and project rebuilding, a customized mass production
programming tool with Atmel-ICE will be generated.
4. References
• ATmega328PB datasheet (http://www.microchip.com/wwwproducts/en/atmega328pb)
• ATmega328PB Xplained Mini kit (http://www.microchip.com/developmenttools/productdetails.aspx?
partno=atmega328pb-xmini)
5. Revision History
Doc. Rev. Date Comments
B 12/2017 Introduction updated to
recommend professional
production programmers than
Atmel-ICE.
A 07/2017 Initial document release.
Customer Support
Users of Microchip products can receive assistance through several channels:
• Distributor or Representative
• Local Sales Office
• Field Application Engineer (FAE)
• Technical Support
Customers should contact their distributor, representative or Field Application Engineer (FAE) for support.
Local sales offices are also available to help customers. A listing of sales offices and locations is included
in the back of this document.
Technical support is available through the web site at: http://www.microchip.com/support
• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their
code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the
code protection features of our products. Attempts to break Microchip’s code protection feature may be a
violation of the Digital Millennium Copyright Act. If such acts allow unauthorized access to your software
or other copyrighted work, you may have a right to sue for relief under that Act.
Legal Notice
Information contained in this publication regarding device applications and the like is provided only for
your convenience and may be superseded by updates. It is your responsibility to ensure that your
application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY
OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS
CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE.
Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life
support and/or safety applications is entirely at the buyer’s risk, and the buyer agrees to defend,
indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting
from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual
property rights unless otherwise stated.
Trademarks
The Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BeaconThings,
BitCloud, CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KeeLoq, KeeLoq logo,
Kleer, LANCheck, LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB,
OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, Prochip Designer, QTouch, RightTouch, SAM-BA,
SpyNIC, SST, SST Logo, SuperFlash, tinyAVR, UNI/O, and XMEGA are registered trademarks of
Microchip Technology Incorporated in the U.S.A. and other countries.
ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight
Load, IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip
Technology Incorporated in the U.S.A.
Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom,
chipKIT, chipKIT logo, CodeGuard, CryptoAuthentication, CryptoCompanion, CryptoController,
dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial
Programming, ICSP, Inter-Chip Connectivity, JitterBlocker, KleerNet, KleerNet logo, Mindi, MiWi,
motorBench, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient
Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PureSilicon, QMatrix, RightTouch logo, REAL
ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total
Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are
trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.
GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their respective companies.
© 2017, Microchip Technology Incorporated, Printed in the U.S.A., All Rights Reserved.
ISBN: 978-1-5224-2476-5
ISO/TS 16949
Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer
fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California
® ®
and India. The Company’s quality system processes and procedures are for its PIC MCUs and dsPIC
®
DSCs, KEELOQ code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design and manufacture of development
systems is ISO 9001:2000 certified.