This user guide describes how to get started with the Atmel® ATmega328PB
Xplained Mini board. The ATmega328PB Xplained Mini evaluation kit is a
hardware platform to evaluate the Atmel ATmega328PB microcontroller. The
evaluation kit comes with a fully integrated debugger that provides seamless
integration with Atmel Studio 6.2 (and later version). The kit provides access
to the features of the ATmega328PB enabling easy integration of the device
in a custom design.
How to connect the ATmega328PB UART to a COM port.
All Xplained Mini boards have an embedded debugger (mEBDG) with a number of features, among them
a CDC/COM port, which enables the user to connect the ATmega328PB UART to the PC.
1.Connect the Xplained Mini USB to the PC.
2.A COM port named "mEDBG Virtual COM Port" will be available.
3.Start a terminal emulator or other applications using the COM port, typical COM port settings are
9600 baud N81.
1.4. Programming and Debugging
Programming and debugging the ATmega328PB Xplained Mini.
The target micro-controller is the ATmega328PB.
The mEDBG FW is running on the ATmega32U4.
1.4.1. Programming the Target using mEDBG
Using the Embedded Debugger on the ATmega328PB Xplained Mini board to program the
ATmega328PB and setting the fuses.
1.Connect the Xplained Mini USB to the PC.
2.Go to Atmel Studio: click the Tools tab, select Device Programming, and select the connected
mEDBG as Tool with Device as ATmega328PB and Interface to SPI, click Apply.
3.Select "Memories" and locate the source .hex or .elf file and click Program.
4.NOTE: If a previous debug session was not closed 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.
5.If the source file contains fuse settings, select "Production file" and upload the .elf file to program
the fuses.
6.Select "Fuses" to program the fuses manually. Set the fuse(s) and click "Program". Recommended
fuse settings:
1.4.2. Debugging the Target using mEDBG
Using the Embedded Debugger on the ATmega328PB Xplained Mini board to debug the ATmega328PB
via debugWIRE.
1.Start Atmel Studio.
2.Connect the Xplained Mini USB to the PC.
3.Open your project.
4.Click the "Project" tab and select the project "properties", click the "Tools" tab and select mEDBG
as debugger and debugWIRE as interface.
5.Click the "Debug" tab and select "Start Debugging and Break".
6.Atmel Studio will display an error message if the DWEN fuse in the ATmega328PB is not enabled,
click YES to make Studio set the fuse using the SPI 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 tab, this will
disable the DWEN fuse.
Important: 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.
Important: If any other CPU CLK than the external CLK supplied by the mEDBG is used the
debugWIRE is not guaranteed to work.
Important: 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.4.3. Programming the Target using an External Programmer
How to program the target ATmega328PB using the AVR® JTAGICE mkII, JTAGICE3, Atmel-ICE, or
other Atmel Programmers.
1.Connect the External Programmer USB to the PC.
2.Connect the External Programmer to the ATmega328PB Xplained Mini board SPI connector.
3.Go to Atmel Studio: click the Tools tab, select Device Programming, and select the External
Programmer connected as Tool with Device as ATmega328PB and Interface to SPI, click Apply.
4.Select "Memories" and locate the source .hex or .elf file and click Program.
1.4.4. Programming the ATmega32U4 using an External Programmer
How to program the ATmega32U4 using the AVR® JTAGICE mkII, JTAGICE3, Atmel-ICE, or other Atmel
Programmers.
1.Connect the External Programmer USB to the PC.
2.Connect the External Programmer to the ATmega328PB Xplained Mini board JTAG connector.
3.Go to Atmel Studio: click the Tools tab, select Device Programming, and select the connected
mEDBG as Tool with Device as ATmega32U4 and Interface to JTAG, click Apply.
4.Select "Memories" and locate the source .hex or .elf file and click Program.
The Xplained Mini board can easily be assembled into a product prototype for software development and
hardware verification.
1.5.1. Custom Assembly
All signals of the ATmega328PB are available in the Xplained Mini board connector grid, enabling easy
connection of external sensors and output devices in order to prototype the customer specific application.
1.5.2. Standalone Node
The ATmega328PB Xplained Mini board can be used as a standalone node with an external power
source, e.g. the 4xAAA or 2xAAA battery pack available from Atmel.
1.5.3. Connecting an Arduino Shield
Arduino® shields can be mounted in the marked positions (J200, J201, J202, and J203) .
1.6. mEDBG Command Line Interface
The mEDBG has a command line interface enabling configuration of the mEDBG.
1.6.1. mEDBG Low Power Modes
There are two modes enabling the Xplained Mini to save power when connected to an external power
source other than an USB connection.
Sleep Mode where the mEDBG is disabled. When enabled the ATmega32U4 will enter sleep mode if not
enumerated within about 5sec. In this mode the external clock is not available to the target MCU.
1MHz Mode where the mEDBG/ATmega32U4 is set to run at 1MHz, saving power while maintaining the
USB connection for the COM port. The external clock will be 1MHz.
The mEDBG does not initially allow users to program the CLK related fuses in the target. This is done to
avoid problems with the debugger when the target and mEDBG is not in CLK sync. This filter can be
disabled by issuing the command 0xFE ( bit0 = 0) enabling configuration of all ATmega328PB fuses.
enabledenabledenabled
8MHz (@3V3)
1.6.3. How to Issue Commands
The command line interface is supported by mEDBG version 1.6 or later.
The mEDBG command line interface can be accessed with the Python script found on Atmel Spaces
If you have Studio 7.0 (and later versions), the mEDBG included supports the command line interface, if
not, the mEDBG can be downloaded from Atmel Spaces Releases (medbg_fw.zip).
Basic Python is required to run the script, Python can be downloaded from Python.
How to issue commands
1.Install Python.
2.Download the file "mEDBG_script.zip" from Atmel Spaces Releases.
3.Unzip the file "mEDBG_script.zip".
4.Edit "stuff.py" to issue the selected command "c.set_suffer(0xXX)".
5.Open a command window in the directory where "stuff.py" is located. (Browse to the, folder rightclick on folder with shift pressed and select “Open command window here”.)
6.Connect the Xplained Mini.
7.Run "stuff.py" (c:\Python27\python stuff.py).
8.The script will print the selected tool and display SUFFER setting.
9.Recycle power (disconnect/connect the board) for the change to take effect.
10. Edit "stuff.py" to issue the command c.set_suffer(0xFF) to reset to factory setting.
4.In the Device Programming window, select Tool to mEDBG and click Apply. If there is a new
mEDBG version available, the Atmel Studio will ask if you want to upgrade.
5.To verify mEDBG version, click "Tool Information" when mEDBG is selected as Tool.
Up to 4 QTouch buttons are available on the ATmega328PB Xplained Mini board. The QTouch area can
be configured as buttons or as a limited slider. For a typical button or slider reference design use the QT1
Xplained Pro extension.
Tip: There is a range of QTouch reference designs demonstrated with the QT Xplained Pro
extensions located at
Xplained - Atmel Xplained prototyping and evaluation platform.
Table 2-7 QTouch Buttons Wiring
ButtonATmega328PBPTC
APE2 via 100k.Y6
VPE3 via 100k.Y7
RPC3 via 100k.Y3
SConnected via 0Ω to A enabling slider
configuration.
In the default HW configuration the QTouch area can be configured in SW as 3 buttons or as a limited
slider.
To get 4 buttons the S touch area can be connected to e.g. PC2 by removing the 0Ω resistor R214 and
adding a wire or a 100k resistor from PC2 (D1) to the test point in B5.5.
.
2.4. On-board Power Supply
The ATmega328PB Xplained Mini board has an on-board 3.3V regulator (150mA) which can be used to
power the ATmega328PB.
The J300 and J301 headers configure the ATmega328PB power supply and the board power source.
The default configuration is set by R300 and R301 0Ω resistors which can be easily removed to change
the default configuration.
Table 2-8 Board Power Options
ModeJ301 connection,
target
J300 connection,
board
Function
5V (Default) pin2 connected to pin1 pin2 connected to pin1Board and target powered by VBUS
3.3V USBpin2 connected to
pin3, remove R301
VINpin2 connected to pin1 pin2 connected to pin3,
3.3V VINpin2 connected to
pin3, remove R301
pin2 connected to pin1Target powered by 3.3V and USB
interface powered by VBUS
Board and target powered by VIN,
remove R300
pin2 connected to pin3,
remove R300
J202.8. 1.8V < VIN < 5.5V
Target powered by 3.3V. VIN as
regulator input. 4V < VIN < 16V
Tip: Use the BOD LEVEL fuse to avoid the following challenges:
For the CPU to successfully decode and execute instructions, the supplied voltage must always
stay above the minimum voltage level set by the chosen operating frequency.
When supplied voltage drops below this level, the CPU may start to execute some instructions
incorrectly. The result is unexpected activity on the internal data and control lines.
This activity may cause CPU Registers, I/O Registers and Data Memories to get corrupted.
To avoid these problems, the CPU should be prevented from executing code during periods of
insufficient supply voltage.
2.5. mEDBG
The ATmega328PB Xplained Mini board has an embedded debugger/programmer enabling debugging
and programming of the ATmega328PB without any additional external equipment.
2.5.1. mEDBG Status LED
The mEDBG has a green status LED connected to ATmega32U4 PC6 to signal the embedded debugger
state.
EnumerationONDuring the initial USB connection process the LED is on until enumerated
ProgrammingONThe LED is on during programming
DebuggingONThe LED is on when the debugger is running
2.5.2. mEDBG External Clock
The mEDBG (ATmega32U4) clock out signal (PC7) is connected to the ATmega328PB external clock
input signal and can be used as the system clock source. The External Clock frequency is 16MHz when
the target is running at 5V and 8MHz when running at 3V3.
Tip: The External Clock can be set to 1MHz to save power using the mEDBG command line
interface.
Tip: There is a test point marked EXT.CLK enabling easy measuring and/or connection to the
CLK signal.
or if not enumerated it is turned off within about 5 seconds
2.5.3. mEDBG COM Port Connection
The mEDBG provide a CDC COM port connection when connected to a USB host device.
The mEDBG (ATmega32U4) USART is used for communication with the CDC COM port. The USART
TX/RX signals are available on the J104 header and are also connected to the ATmega328PB via 0Ω
resistors enabling easy disconnect from the ATmega328PB if needed.
Table 2-10 J104 USART Header
J104 pinATmega32U4ATmega328PBFunction
1 - USART TxD PD3PD1TxD out from ATmega32U4
2 - USART RxD PD2PD0RxD in to ATmega32U4
2.5.4. mEDBG JTAG Interface
The mEDBG (ATmega32U4) JTAG interface is available for programming and debugging of the
ATmega32U4.
The general bus connections for an Xplained PRO Extension board is indicated in the table below,
detailed wiring can be found in the selected extension board documentation.
Table 2-13 Extension Header Typical Signals
PinSignal nameSignal description
1IDCommunication line to the ID chip on the Xplained extension board
2GNDGround
3ADC(+)Analog to digital converter, alternatively positive part of differential ADC
4ADC(-)Analog to digital converter, alternatively negative part of differential ADC
5GPIO1General purpose I/O
6GPIO2General purpose I/O
7PWM(+)Pulse width modulation, alternatively positive part of differential PWM
8PWM(-)Pulse width modulation, alternatively negative part of differential PWM
9IRQ/GPIOInterrupt request line and/or general purpose I/O
10SPI_SS_B/
GPIO
11I2C_SDAData line for I2C interface
12I2C_SCLClock line for I2C interface
13UART_RXReceiver line of ATmega328PB USART
14UART_TXTransmitter line of ATmega328PB USART
15SPI_SS_ASlave A select for SPI
16SPI_MOSIMaster out slave in line of serial peripheral interface
17SPI_MISOMaster in slave out line of serial peripheral interface
18SPI_SCKClock for serial peripheral interface
19GNDGround
20VCCPower for extension board
2.7. Factory Programmed
The ATmega328PB is preprogrammed with a demo program, ReMorse.
Source code is available in Atmel Spaces.
Slave B select for SPI and/or general purpose I/O
When the CDC COM port is connected to a terminal window (9600 N81), the text you write will be
transmitted via the LED in Morse code. Any Morse code transmitted by using the switch will be displayed
as text in the terminal window.
Atmel®, Atmel logo and combinations thereof, Enabling Unlimited Possibilities®, AVR®, QTouch®, and others are registered trademarks or trademarks of Atmel
Corporation in U.S. and 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 any
intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND
CONDITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED
OR 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, BUSINESS
INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN 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 the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to
update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive
applications. 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 any
applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without
an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the
operation of nuclear facilities and weapons systems. Atmel products are not designed nor intended for use in military or aerospace applications or environments
unless specifically designated by Atmel as military-grade. Atmel products are not designed nor intended for use in automotive applications unless specifically
designated by Atmel as automotive-grade.
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.