-
AVR 8-bit Microcontrollers
AT06621: Getting Started with AtmelATmega324PB
APPLICATION NOTE
Description
This application note is for getting started with the Atmel
ATmega324PBAVR based microcontroller.
Features
Getting started with the ATmega324PB microcontroller and tools
Getting started with Atmel ATmega324PB Xplained Pro Kit and
Atmel
Studio 7
This application note contains a list of all tools required to
start usingATmega324PB and provides references for additional
information.
Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
-
Table of Contents
Description.......................................................................................................................1
Features..........................................................................................................................
1
1. Getting Started with Atmel
ATmega324PB................................................................31.1.
Key
Features................................................................................................................................
31.2. Device Related Website
Links......................................................................................................31.3.
ATmega324PB Xplained Pro
Kit...................................................................................................51.4.
Atmel
Studio.................................................................................................................................
7
1.4.1. Atmel Studio Webpage
.................................................................................................
71.4.2. Atmel Studio
Microsite...................................................................................................
7
1.5. Connecting the ATmega324PB Xplained Pro
kit..........................................................................71.5.1.
Auto Board Identification of Xplained Pro Kit
................................................................81.5.2.
Connect the ATmega324PB Xplained Pro UART to the EDBG COM
Port....................9
2. Creating an Example Application in Atmel
Studio................................................... 10
3. Whats
next?............................................................................................................
13
4. Revision
History.......................................................................................................14
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
2
-
1. Getting Started with Atmel ATmega324PB
1.1. Key Features AVR (Harvard) architecture Single level
pipelining In-system reprogrammable flash memory Separate EEPROM
section available Optional boot code section with independent lock
bits 20MIPS @ 20MHz Most single clock cycle execution Low-power
microcontroller with various sleep modes High code density
(advanced RISC Instruction Set) On-chip hardware multiplier Short
interrupt latency four clock cycles Factory calibrated internal RC
oscillator Security with fuses and lock bits Atmel QTouch Library
support Compatibility between devices (portability) Peripheral
touch controller Clock Failure Detection (CFD)
Note: For more information about ATmega324PB, refer to the
device datasheet.
1.2. Device Related Website LinksThe ATmega324PB product webpage
is available at:
http://www.atmel.com/devices/ATMEGA324PB.aspx
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
3
http://www.atmel.com/devices/ATMEGA324PB.aspx
-
Figure 1-1.Device Webpage
The product webpage has five tabs that provide specific
information related to the device.
The Overview tab provides the basic information related to the
device such as Key Parameters,Datasheet, link to buy the device,
etc.http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=overview
The Parameters tab provides the details of various configuration
parameters for the device.
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
4
http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=overview
-
http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=parameters The
Documents tab provides all the related documents such as datasheet
and application notes.
http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=documents
The Datasheet section contains two types of
datasheets:Preliminary / Complete version includes all peripheral
descriptions and electricalcharacteristics.
Preliminary Summary / Summary version includes ordering
information, pin out, andpackaging information.
The Application Notes section has the device related Application
Notes such as PeripheralUsage, Getting Started, Hardware design
considerations, etc. and its associated firmware (ifavailable).
The Applications tab provides the recommended application areas
(not limited to) for this
device.http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=applications
The Tools tab, all the related tools such as IDE, Programmer,
Debugger, Evaluation Kits, BSDLfiles are listed. This tab features
the link to ATmega324PB Xplained Pro kits
webpage.http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=tools
1.3. ATmega324PB Xplained Pro KitThe details about ATmega324PB
Xplained Pro Kit is available in the following link.
http://www.atmel.com/tools/ATMEGA324PB-XPRO.aspx
Device Ordering Information is available in the bottom section
of the page.
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
5
http://www.atmel.com/devices/ATMEGA324PB.aspx?tab=parametershttp://www.atmel.com/devices/ATMEGA324PB.aspx?tab=documentshttp://www.atmel.com/devices/ATMEGA324PB.aspx?tab=applicationshttp://www.atmel.com/devices/ATMEGA324PB.aspx?tab=toolshttp://www.atmel.com/tools/ATMEGA324PB-XPRO.aspx
-
Figure 1-2.ATmega324PB Xplained Pro Webpage
Documents tab displays the kit related documents such as
schematics and user guides.
http://www.atmel.com/tools/ATMEGA324PB-XPRO.aspx?tab=documents
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
6
http://www.atmel.com/tools/ATMEGA324PB-XPRO.aspx?tab=documents
-
Note: For detailed information about the kit such as headers and
connections, refer to ATmega324PBXplained Pro User Guide.
1.4. Atmel Studio
1.4.1. Atmel Studio WebpageThe Atmel Studio installer (free IDE)
is available at:
http://www.atmel.com/tools/ATMELSTUDIO.aspx
1.4.2. Atmel Studio MicrositeTo learn more about Atmel Studio,
refer to the following microsite:
http://www.atmel.com/microsite/atmel-studio/Figure 1-3.Atmel
Studio Microsite Webpage
In the Videos tab the getting started videos such as creating a
new C (GCC) project, debugging AVRapplications, debugging ARM
applications, etc. are available.
http://www.atmel.com/Microsite/atmel-studio/videos.aspx
1.5. Connecting the ATmega324PB Xplained Pro kitThis section
helps the user to connect the ATmega324PB Xplained Pro with the
Atmel Studio 7.
1. Download and install Atmel Studio 7 or later versions.2.
Launch the Atmel Studio.3. Connect the ATmega324PB Xplained Pro to
the USB port.It will be visible in the Atmel Studio.
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
7
http://www.atmel.com/tools/ATMELSTUDIO.aspxhttp://www.atmel.com/microsite/atmel-studio/http://www.atmel.com/Microsite/atmel-studio/videos.aspxhttp://www.atmel.com/tools/ATMELSTUDIO.aspx
-
1.5.1. Auto Board Identification of Xplained Pro Kit When the
ATmega324PB Xplained Pro kit is connected to the PC, the Windows
Task bar will pop-
up a message, as displayed in the following screenshot.Figure
1-4.ATmega324PB Xplained Pro Driver Installation
If the driver installation is successful, EDBG will be listed in
the Device Manager, as displayed in thefollowing screenshot.Figure
1-5.Successful EDBG Driver Installation
Open Atmel Studio. Go to, View > Available Atmel Tools. The
EDBG should be listed in the tools as EDBG and the
tool status should display as Connected. This indicates that the
tool is communicating as expectedwith the Atmel Studio.
Figure 1-6.EDBG under Available Atmel Tools
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
8
-
1.5.2. Connect the ATmega324PB Xplained Pro UART to the EDBG COM
Port1. Connect the EDBG USB to the PC.2. Use the Device Manager to
find the COM port number.3. Default COM port settings are 9600 baud
N 8 1. The COM port settings can be changed by using
the Device Manager.
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
9
-
2. Creating an Example Application in Atmel Studio1. After
connecting the board, to create a new project in Atmel Studio, go
to File > New > Project.
Figure 2-1.Creating New Project in Atmel Studio
2. In the New Project wizard displayed, select the GCC C
executable Project template, name theproject, and click OK to get
the Device Selection wizard.Figure 2-2.New Project Wizard
3. The Device Selection wizard appears as shown in the following
image. Select the ATmega324PBdevice from megaAVR device family and
click OK.Figure 2-3.Device Selection Wizard
4. The new project and the main.c file will be created as
follows.
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
10
-
Figure 2-4.Project Window
5. Add the following code snippet (LED control using push
button) in the main.c file.int main(void){ /* enable the pull-up
function */ MCUCR &= ~(1
-
In the example code demonstrated Button connected to pin PC6 is
configured as input withPull-up enabled. Pin PC7 is connected to
LED0 and configured as output.
Here the LED0 is controlled based on the Button status As long
the button is not pressed, the LED0 will not glow and on pressing
the button the LED0
will glow7. To debug the project, go to Project > Properties
> Tool > Selected Debugger/Programmer and
select the Tool as EDBG and Interface as JTAG.Figure 2-5.Tool
and Interface Settings
8. To program and execute the application there are two options:
Start a debug session on the board, where the user will be able to
program and debug Program the generated .hex file into the
controller and execute the application
Choose one of these options in Atmel Studio as shown in the
following screen capture.Figure 2-6.Start without Debugging
Figure 2-7.Start Debugging and Break
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
12
-
3. Whats next? Atmel Studio videos
http://www.atmel.com/Microsite/atmel-studio/videos.aspx Atmel
Studio online help
http://www.atmel.com/webdoc/atmelstudio/ Atmel Studio offline
help (After installing Atmel Studio)
Open Atmel Studio, Help > View Help (Ctrl+F1) > Atmel
Studio ASF (Atmel Software framework) Getting Started and ASF
Reference manual
http://www.atmel.com/tools/AVRSOFTWAREFRAMEWORK.aspx?tab=documents
ASF online documentation
http://asf.atmel.com/docs/latest/ Technical documentation for
various products
http://www.atmel.com/webdoc/ Atmel Gallery
https://gallery.atmel.com/ Production Selection Guide
Atmel MCU Selector on http://www.atmel.com/ Ordering Samples and
Buying evaluation board and kits:
http://www.atmel.com/. Go to Buy > Atmel store Technical
Documentation
http://www.atmel.com/design-support/documentation/default.aspx
Knowledge Base and Technical Support/Design Support
http://www.atmel.com/design-support/ Collaborative workspace
http://spaces.atmel.com AVR Freaks community
http://www.avrfreaks.net/
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
13
http://www.atmel.com/Microsite/atmel-studio/videos.aspxhttp://www.atmel.com/webdoc/atmelstudio/http://www.atmel.com/tools/AVRSOFTWAREFRAMEWORK.aspx?tab=documentshttp://asf.atmel.com/docs/latest/http://www.atmel.com/webdoc/https://gallery.atmel.com/http://www.atmel.com/http://www.atmel.com/http://www.atmel.com/design-support/documentation/default.aspxhttp://www.atmel.com/design-support/http://spaces.atmel.comhttp://www.avrfreaks.net/
-
4. Revision HistoryDoc. Rev. Date Comments
42626A 03/2016 Initial document release
Atmel AT06621: Getting Started with Atmel ATmega324PB
[APPLICATION
NOTE]Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
14
-
Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA
T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 | www.atmel.com
2016 Atmel Corporation. / Rev.:
Atmel-42626A-Getting-Started-with-Atmel-ATmega324PB_AT06621_Application
Note-03/2016
Atmel, Atmel logo and combinations thereof, Enabling Unlimited
Possibilities, AVR, AVR Freaks, megaAVR, QTouch, and others are
registered trademarks ortrademarks of Atmel Corporation in U.S. and
other countries. ARM is a registered trademark of ARM Ltd.
Windowsis a registered trademark of MicrosoftCorporation in U.S.
and or other countries. Other terms and product names may be
trademarks of others.
DISCLAIMER: The information in this document is provided in
connection with Atmel products. No license, express or implied, by
estoppel or otherwise, to anyintellectual property right is granted
by this document or in connection with the sale of Atmel products.
EXCEPT AS SET FORTH IN THE ATMEL TERMS ANDCONDITIONS OF SALES
LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER
AND DISCLAIMS ANY EXPRESS, IMPLIEDOR STATUTORY WARRANTY RELATING TO
ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF
MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE, OR
NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
INDIRECT,CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES
(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS,
BUSINESSINTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE
USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN
ADVISEDOF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no
representations or warranties with respect to the accuracy or
completeness of the contents of thisdocument and reserves the right
to make changes to specifications and products descriptions at any
time without notice. Atmel does not make any commitment toupdate
the information contained herein. Unless specifically provided
otherwise, Atmel products are not suitable for, and shall not be
used in, automotiveapplications. Atmel products are not intended,
authorized, or warranted for use as components in applications
intended to support or sustain life.
SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS
DISCLAIMER: Atmel products are not designed for and will not be
used in connection with anyapplications where the failure of such
products would reasonably be expected to result in significant
personal injury or death (Safety-Critical Applications) withoutan
Atmel officer's specific written consent. Safety-Critical
Applications include, without limitation, life support devices and
systems, equipment or systems for theoperation of nuclear
facilities and weapons systems. Atmel products are not designed nor
intended for use in military or aerospace applications or
environmentsunless specifically designated by Atmel as
military-grade. Atmel products are not designed nor intended for
use in automotive applications unless specificallydesignated by
Atmel as automotive-grade.
https://www.facebook.com/AtmelCorporationhttps://twitter.com/Atmelhttp://www.linkedin.com/company/atmel-corporationhttps://plus.google.com/106109247591403112418/postshttp://www.youtube.com/user/AtmelCorporationhttp://en.wikipedia.org/wiki/Atmelhttp://www.atmel.com
DescriptionFeaturesTable of Contents1.Getting Started with Atmel
ATmega324PB1.1.Key Features1.2.Device Related Website
Links1.3.ATmega324PB Xplained Pro Kit1.4.Atmel Studio1.4.1.Atmel
Studio Webpage1.4.2.Atmel Studio Microsite
1.5.Connecting the ATmega324PB Xplained Pro kit1.5.1.Auto Board
Identification of Xplained Pro Kit1.5.2.Connect the ATmega324PB
Xplained Pro UART to the EDBG COM Port
2.Creating an Example Application in Atmel Studio3.Whats
next?4.Revision History