Revision: February 9, 2009
Note: This document applies to REV A-B of the board.
www. d i g i l e n t i n c . c om
215 E Main Suite D | Pullman, WA 99163
(509) 334 6306 Voice and Fax
Overview
The Nanocon board is useful for
embedded control and robotics projects for
both students and hobbyists.
The Nanocon’s versatile design and
programmable microcontroller allows you
to control different external devices and
program the board for multiple uses. The
board has many I/O connectors, power
supply options, and supports a number of
programming tools including ATMEL AVR®
STUDIO 4, and WinAVR.
Power
connector
4 LEDs
The Nanocon has a number of connections
for peripheral devices. Digilent peripheral
modules (Pmods™) include H-bridges,
analog-to-digital and digital-to-analog
converters, a speaker, switches, buttons,
LEDs, RS232 converters, screw terminal
connectors, BNC connectors, servo
motors, and more. For more information
see www.digilentinc.com.
Features include:
• ATmega168 microcontroller
• four 6-pin connectors for Digilent
Pmod peripheral module boards
• four LEDs
• ESD protection for all I/O pins
• in-system programming support
16K Flash
(Internal)
512 EEPROM
(Internal)
1k SRAM
(Internal)
ATMega168
MLF32
4
JA
connectors
TM
444
JB
IO
J2
TW I
Nanocon
2
J1
SPI/
ISP
TW I/
RS232
Four 6-pin PMOD
Nanocon Circuit Diagram
Internal
Oscillator
UART, SPI,
& TWI ports
JC
IO
using the Digilent parallel JTAG
cable or the Digilent USB JTAG/SPI
cable.
Doc: 502-095 page 1 of 6
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Nanocon Reference Manual
Features of the ATmega168 include:
•
master/slave serial peripheral
interface (SPI)
•
programmable serial USART
interface
•
Atmel two wire serial interface (TWI)
•
eight channel, 10-bit ADC
•
two 8-bit timer/counters
•
one 16-bit timer/counter
•
16KB program flash
•
512 byte EEPROM
•
1KB internal SRAM
•
analog comparator.
For more information on the ATmega168
microcontroller, refer to the data sheet
available at www.atmel.com.
Functional Description
The Nanocon is designed for embedded
control and robotic applications as well as
microprocessor experimentation.
Embedded firmware, suitable for many
applications, can be programmed into the
Nanocon’s ATmega168 microcontroller.
Although the Nanocon can be used as a
stand-alone microcontroller board, it is also
designed to be part of a larger system
using a distributed processing architecture.
Connector J1 allows the Nanocon to be
plugged directly into other Digilent
microcontroller boards, such as the
Cerebot™ or the Minicon™. Using a 6-wire
cable and the Digilent Module Interface
Board, it can be connected to a Digilent
FPGA board.
The Nanocon can be programmed with
firmware to perform local control functions.
It can then be controlled by, and report
back to, a higher level controller in the host
controller board. For example, the
Digilent, Inc.
www.digilentinc.com
Nanocon could be programmed to perform
closed-loop motor speed control. It could
relieve extra work for the host processor,
when performing the motor speed control,
by processing commands from the host
and controlling the motors itself.
Communication Options
Connector J1 provides access to the
master/slave SPI. SPI is a high-speed,
synchronous, serial interface used by
many serial peripheral devices like A/D and
D/A converters. The SPI interface is used
both for in-system-programming the
ATmega168 and for a user-accessible SPI
port. The Digilent PmodAD1 and
PmodDA1 modules use the SPI interface.
Connector J1 and the SPI interface are
also used for in-system-programming of
the ATmega168 microcontroller.
Connectors JA and J2 provide access to
the Atmel two-wire interface (TWI). The
TWI is a medium speed (200-400 Kbps)
serial bus that allows up to 128 devices to
connect. Connector J2 can be used for
continuing the TWI bus to other boards.
The ATmega168 microcontroller provides a
USART that can be used for asynchronous or
synchronous serial communications. However,
the Nanocon doesn’t provide for a crystal
oscillator, and the internal RC oscillator isn’t
accurate enough for reliable asynchronous
communications. It is sometimes possible to
tune the oscillator using the calibration register
to allow asynchronous communications to
work.
6-Pin Pmod Headers
The Nanocon has four 6-pin header
connectors for connecting to generalpurpose, off-board digital I/O or to specific
ATmega168 features like analog-to-digital
www.digilentinc.com page 2 of 6
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Nanocon Reference Manual
converters or pulse-width modulators.
Each 6-pin connector provides four signals,
power, and ground. These connectors are
specifically designed to work with the
Digilent Pmod line of peripheral boards, but
can be used to connect to any off-board
I/O devices.
See Table 1 for more information on
connecting peripheral modules and other
devices to the Nanocon. Table 1 shows the
connectors with their designed base
function and a map to the ATmega168 I/O
ports. All I/O port signal pins can be used
for general-purpose digital I/Os.
Power Supply Connectors
The Nanocon is rated for external power
ranging from 2.7 to 5.5 volts DC. Using
voltage outside this range could damage
the Nanocon and connected devices.
The Nanocon can be powered through any
of the board’s 6-pin Pmod headers or the
J3 connector.
Each of these connectors provides a VCC
and a ground pin. A power supply
providing between 2.7 and 5.5 volts can be
connected to the VCC pin on any one of
these connectors.
When the Nanocon is plugged into another
Digilent microcontroller or FPGA board,
that board can power the Nanocon through
the Pmod connector. The host board
should be jumpered to provide 3.3V on the
VCC pin of the Pmod connector being
used. The Nanocon will then be powered
by the host board’s power supply, and will
in turn provide power from the host board
to any peripheral boards connected to the
Nanocon’s other Pmod connectors.
www.digilentinc.com
For standalone applications, the Digilent
PmodREG1 is a voltage regulator module
that can be used to supply the required
operating voltage.
Device Programming
The Nanocon has one in-systemprogramming connector, J1. The Digilent
programming cable is connected to J1.
Either a parallel JTAG or USB JTAG/SPI
cable can be used. When connecting the
programming cable, ensure that the VCC
and GND pin labels from the cable match
to the VCC and GND pins on the Nanocon.
A power supply must be provided to the
Nanocon when programming. The Digilent
programming cable does not supply power
to the board; the board it is plugged into
powers the programming cable. The
Digilent PmodREG1 voltage regulator
module can be used, or any appropriately
regulated power supply can be connected
to J3. If the Nanocon is being used in
conjunction with another Digilent board,
such as the Cerebot or Minicon, these
boards have connectors that can be used
to supply power to the J3 connector on the
Nanocon using a two-wire cable.
Programming can be accomplished using
the Digilent AVRP application, available by
free download from the Digilent web site. It
is also possible to configure the AVRDUDE
programmer in the WinAVR release for insystem-programming using the Digilent
parallel JTAG cable. See the
documentation for these applications for
more information on board programming.
Connector J1 is used both for in-systemprogramming and for user access to the
SPI controller. The jumper block JP1 is
used to select between the two functions.
Digilent, Inc.
The shorting block is placed in the RST
www.digilentinc.com page 3 of 6
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Nanocon Reference Manual
position for in-system-programming, and in
the SS position for user access to the SPI
port.
AVR Clock Fuse Settings
AVR microcontrollers use control bits called
fuses to set basic operating parameters for the
device. The SPI controller uses the clock
source set by the fuses for its clock. If the clock
source fuses are set to select a clock source
that doesn’t exist on the board, the SPI
controller won’t work and it will no longer be
possible to program the microcontroller via the
in-system programming protocol. The Nanocon
can only use the internal RC oscillator as the
clock source.
If the external oscillator, or one of the
crystal/resonator clock sources is selected, it
may be possible to recover the board by
applying a suitable clock signal to pin 1 of
connector JA. There is an applications note on
the Digilent web site illustrating this technique
for the Cerebot board.
In addition, the maximum SPI clock frequency
is the selected clock frequency divided by four.
If the 128KHz internal oscillator is selected as
the clock source, the SPI clock would need to
be set to a frequency of 32KHz or less. The
Digilent programming cables do not support
frequencies that low, so if the 128KHz internal
oscillator is selected for the clock source, the
board will no longer be programmable using
the Digilent programming cable.
Two-Wire Serial Interface
The Atmel TWI interface is a medium
speed (400 Kbps), synchronous, serial,
communications bus. The TWI interface
supports master or slave operation with up
to 128 devices on the bus. Each device is
given a unique address, and the protocol
has the ability to address packets to a
www.digilentinc.com
information on configuring and using the
two-wire interface see the ATmega168
data sheet at
www.atmel.com .
The Nanocon has two ways to connect to a
TWI bus. The TWI signals, SCL and SDA,
are available on 6-pin connector JA or on
the 2-pin connector J2.
Pins one and two of connector JA and
connector J2 provide two positions for
connecting to the TWI signals. By using
two-wire cables (available separately from
Digilent), a daisy chain of Nanocons or
other TWI-capable boards can be created.
The TWI bus is an open-collector bus.
Devices on the bus actively drive the
signals low. When no device is driving the
lines low, pull-up resistors achieve the high
state on the TWI lines. A single device on
the TWI bus must provide the pull-up
resistors.
The Nanocon provides pull-up resistors
that are controlled by software. I/O port B,
bits 6 and 7 (PB6 and PB7), is connected
to the pull-up resistors. To enable the pullups, configure these pins as outputs and
set the I/O port output bits to “1”. To
disable the pull-ups, configure these pins
as inputs with the internal pull-ups
disabled. Both TWI pull-ups should be
enabled or disabled together. Only one
device on the TWI bus should have pullups enabled.
A port bit is configured as an input or an
output by setting the corresponding bit in
the DDR register. The pin becomes an
output by writing a “1” and an input by
writing a “0”. When a pin is configured as
an input, an internal pull-up resistor is
enabled by writing the corresponding
output port bit to “1” and disabled by writing
Digilent, Inc.
specific device or to broadcast packets to
all devices on the bus. For detailed
www.digilentinc.com page 4 of 6
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Nanocon Reference Manual
it to “0”. See the Atmel Atmega168 data
sheet for more information.
On-Board User I/O
The Nanocon provides four on-board LEDs
for user output. The LEDs are connected to
I/O Port D, bits 4-7 (PD4-PD7). An LED is
turned on by writing the pin to logic 1 and
turned off by writing the pin to logic 0.
Digilent, Inc.
www.digilentinc.com
www.digilentinc.com page 5 of 6
Copyright Digilent, Inc. All rights reserved. Other product and company names mentioned may be trademarks of their respective owners.
Nanocon Reference Manual
Table 1: Connectors
Pin Description: All Pmod connector pins can be used for
general purpose I/Os. The following descriptions are
for used with specific Digilent Pmod modules:
JA Serial port communications
JB Analog input
Pin Function Port/bit
The USART serial port and the ATMEL TWI interface can
be accessed on this connector.
This connector provides inputs to the analog to digital
converter of the ATmega168.
This connector is for use with an H-bridge module. For a
single bridge module, pins 1 and 2 are the direction and
enable signals for the bridge. Pins 3 and 4 are for encoder
feedback. For a dual bridge module, pins 1 and 2 are the
direction and enable signals for bridge 1, and pins 3 and 4
are direction and enable for bridge 2.
J1 SPI interface and in-system-programming
When the shorting block on JP1 is in the SS position, J1 is
used for the SPI port. When the shorting block on JP1 is in
the RST position, J1 is used for in-system-programming.
J2 TWI connectors
The ATMEL TWI interface can be accessed on this
connector.