This is only a preview of the March 2006 issue of Silicon Chip. You can view 35 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "PC-Controlled Burglar Alarm System, Pt.2":
Items relevant to "AVR ISP SocketBoard":
Articles in this series:
Items relevant to "Phone/Fax Missed Call Alert":
Purchase a printed copy of this issue for $10.00. |
The prototype SocketBoard is shown here
connected to a genuine Atmel AVR ISP
programmer. It also works with the AVR
in-system programmers described in SILICON
CHIP in October 2001 & 2002.
AVR ISP
SocketBoard
Teamed with an AVR in-system programmer,
this board enables you to program Atmel
microcontrollers on the spot – without
an expensive production programmer or
development system. It supports just about all
dual-in-line AVR micros and includes overcurrent protection.
M
OST ATMEL AVR microcontrollers can be programmed via their
in-built serial programming interfaces
(SPI). This method is ideal for in-situ
programming, such as might be used
in manufacturing or for firmware development or field upgrades.
In this scenario, the micro remains
in its socket on the application board
and a low-cost in-system programmer (ISP) is plugged into a dedicated
programming header. In other words,
the microcontroller does not have to be
removed from its socket and plugged
into a parallel programmer each time
a firmware update is required.
However, in some cases it is desira64 Silicon Chip
ble to program a microcontroller standalone, such as when the application
board is unavailable or doesn’t include
an ISP (or JTAG) header. A low-cost
method of stand-alone programming
might also be useful where a batch of
chips is needed for a small prototype
run and the cost of a commercial parallel programmer is prohibitive.
This is where the AVR ISP SocketBoard comes in. It provides the minimum of functions necessary to support
in-system programming, including a
regulated power supply, clock source
and microcontroller IC socket. Just
connect your in-system programmer
to a PC, plug its ISP cable into the
By PETER SMITH
SocketBoard’s on-board header and
add a DC plugpack. You’re then ready
to start programming!
Programming sockets
As you can see from the photos, the
SocketBoard contains five programming sockets. Why so many? Well,
we’ve provided one programming
socket for each group of micros with
common SPI pinouts. This allowed us
to eliminate the switching logic that
would have been required if we’d used
just a single, 40-pin socket, so greatly
simplifying design and construction.
We expect that many constructors
will install just one or two programming sockets (depending on their
requirements), to keep costs as low as
possible. The overlay diagram (Fig.2)
lists specific device types and the sockets (SK1-SK5) that support them. For
example, to program the ATMega16,
socket SK4 must be installed.
For cases where quantities of chips
need to be programmed, the board
will accept standard zero insertion
force (ZIF) sockets as well. There
is absolutely no need to install ZIF
siliconchip.com.au
Fig.1: the SocketBoard consists of a current-limited power supply, oscillator, ISP
header and a series of programming sockets. This simple configuration supports
most dual-in-line packaged AVR micros. Surface-mounted equivalents can be
accommodated by using commercial DIL adapters.
sockets (as shown in our photos) for
occasional programming; this would
simply be expensive overkill.
The unit can be powered from a 12V
DC 150mA (or higher) unregulated
plugpack, which also powers the ISP
programmer when it’s plugged into the
on-board header.
Operation
As mentioned, the SocketBoard
provides the minimum of functions
necessary to support in-system prosiliconchip.com.au
gramming. As stated, this includes a
series of programming sockets to accommodate the different types of AVR
micros, a regulated power supply, and
a clock source.
The power supply is based around
two series-connected LM317 adjustable positive regulators (see Fig.1).
The first regulator acts as a current
limiter. In normal operation, it performs no function. However, should
the current through R1 increase to a
level where about 1.25V is dropped
across it, REG1 begins to reduce the
voltage at its OUT terminal. In effect,
REG1 then acts as a constant current
source, limiting output current to a
maximum of 125mA.
In normal operation, the complete
setup consumes an average of about
20-40mA, depending on the type of
in-system programmer connected. The
remaining capacity (85-105mA) leaves
a comfortable margin, which in most
cases is still low enough to preserve
any micro that might be accidentally
reversed in a socket. It also protects
other components if an internally
short-circuited micro is plugged into
a socket.
The second regulator (REG2) is
March 2006 65
Fig.2: follow this diagram closely during assembly. Take particular care with the orientation of the electrolytic
capacitors, D1, LED1 and IC1. Also, be sure to install the 10-pin header (CON2) with the keyway facing
towards the programming sockets. Note that although we show ZIF sockets in five positions, most constructors
will require only one or two for high-volume programming.
Fig.3: the full-size etching pattern for the PC board. It can also be downloaded from the SILICON CHIP website.
66 Silicon Chip
siliconchip.com.au
Suitable
Programmers
This project has been tested with three
programmer variants, as follows:
•
SILICON CHIP In-System Programming Adapter, as described in the
October 2001 issue. This very low cost
programmer connects to your PC’s
parallel port. It’s still available in kit form
from Altronics (Cat. K-2885).
•
SILICON CHIP AVR ISP Serial Programmer, as described in the October
2002 issue. For greater compatibility,
this programmer connects to your PC’s
serial port. It’s available as a kit from
Jaycar Electronics (Cat. KC-5340).
•
AVR ISP Programmer. This genuine Atmel item is supplied preassembled and again, it connects to your PC
via a free serial port.You can purchase
these from JED Microprocessors,
phone (03) 9762 3588 or browse to
www.jedmicro.com.au
This is the completed
prototype. Make sure that all
parts are correctly oriented.
configured as a conventional voltage
regulator. Without JP1 installed, it
produces +5V to power the system.
Installing JP1 reduces this to +3V.
Some constructors may find this
lower voltage useful for verifying the
memory in micros that are destined for
3V systems. Note, however, that the
two SILICON CHIP in-system programmers are not designed for operation
at 3V; you’ll need the genuine Atmel
programmer for that job.
As well as power, AVR micros require a clock source for their internal
programming circuits to operate. This
is provided by a Pierce oscillator,
which is composed of a 4MHz crystal (Y1), two resistors and one gate
of a 74HC04 hex inverter (IC1a). A
second gate (IC1b) buffers the clock
signal before it is applied to all of the
programming sockets. A 47W resistor
provides series termination and current limiting.
All that now remains to be described
is the ISP interface. This is extremely
simple indeed, as it consists only of
a 10-pin DIL header (CON2) and five
resistors. The four 100W series resistors act as peak current limiters, in case
the ISP cable or a chip is accidentally
inserted with power applied. These
also help to protect the programmer if
a faulty micro is inserted in a socket.
The remaining resistor (47kW) pulls
siliconchip.com.au
down the interface’s RESET line, so
that the micro is held in the reset state
if a programmer is not connected or is
non-functional.
Assembly
Using the overlay diagram (Fig.2)
as a guide, install all the low-profile
components first, starting with the
wire links and resistors. There are
seven links in total, all of which can be
fashioned from 0.7mm tinned copper
wire or similar.
Follow with all of the capacitors,
noting that the leads of the 10mF and
100mF units must be bent at right angles before installation. Before bending the leads, check that you have the
positive leads oriented correctly.
The crystal (Y1) also mounts horiz
ontally, so bend its leads about 2-3mm
from the can before installation. Once
in place, a short length of tinned copper wire should be soldered to the top
of the can and the pad directly below
to secure it in position.
Diode D1, LED1, header CON2 and
the 14-pin socket for IC1 can now go
in. All of these items are polarised,
so make sure that they’re installed
the right way around. Don’t plug the
74HC04 into its socket just yet, though;
it’s a good idea to test the power supply
first (see below).
All of the remaining items can now
be installed, leaving the five programming sockets (SK1–SK5) until last. The
two LM317 regulators (REG1 & REG2)
should be attached to the PC board
using M3 x 6mm screws, nuts and flat
washers. As shown, their leads must
be bent at right angles before installation. Be sure to tighten the screw & nut
before soldering the leads, otherwise
damage to the regulator package or PC
board may result.
The three 2-pin headers (JP1-JP3)
can be cut down from a longer section
using a sharp knife. Check that each
header is sitting square on the PC board
surface before soldering.
Finally, install just the programming
sockets (SK1-SK5) that you require.
For casual use, low-cost IC sockets
can be installed in any or all of the
indicated positions. Alternatively,
ZIF type sockets can be fitted to any
positions that are expected to be high
usage – it’s up to you.
Testing
Connect a 12V DC source to the DC
socket (CON1), noting that the centre
pin is the positive input. If the power
connections are accidentally reversed,
nothing bad will happen as a series
diode provides polarity protection.
Now apply power by sliding S1’s
March 2006 67
Par t s Lis t
1 PC board coded 07103061,
145 x 105mm
1 4MHz crystal (HC49 package)
(Y1)
1 DPDT PC-mount slide switch
(S1) (Altronics S-2060, Jaycar
SS-0823)
1 10-pin dual-row shrouded
(boxed) PC-mount header
1 2.1mm PC-mount DC socket
(CON1)
2 20-pin IC sockets (SK1 & SK2)
1 28-pin IC socket (SK3)
2 40-pin IC sockets (SK4 & SK5)
1 6-pin 2.54mm (0.1-inch) SIL
header strip (for J1-J3)
3 jumper shunts
6 M3 x 6mm pan head screws
2 M3 x 6mm nuts & washers
4 M3 x 10mm tapped spacers
160mm (approx.) 0.7mm tinned
copper wire (for links)
Note 1: if desired, small stick-on
feet can be used in place of the
tapped spacers.
Semiconductors
1 74HC04 hex inverter (IC1)
2 LM317T adjustable voltage
regulators (REG1 & REG2)
1 1N4004 diode (D1)
1 3mm high-brightness red LED
(LED1)
Capacitors
1 100mF 25V PC electrolytic
1 10mF 16V PC electrolytic
1 220nF 50V MKT polyester
5 100nF 50V monolithic (multilayer) ceramic
2 22pF 50V ceramic disc
Resistors (0.25W, 1% metal film)
1 1MW
1 300W
1 47kW
1 120W
1 1.8kW
4 100W
1 1kW
1 47W
1 360W
1 10W
Note 2: low-cost ZIF sockets in all of
the designated sizes are available
from www.futurlec.com. Higher
quality units of various types are
available from www.dontronics.
com and www.rockby.com.au
actuator towards the edge of the board.
The power LED should light immediately. If it doesn’t, either the power
connections are reversed or there is an
assembly error. Carefully recheck the
68 Silicon Chip
8-pin devices are programmed in the first 20-pin socket (SK1). Here’s how
they’re inserted, with pin 1 in the same position as for 20-pin devices. Note that
jumper shunts must be installed on JP2 & JP3 when programming 8-pin devices.
board against the overlay diagram and
look for dry or missed solder joints.
Next, use your multimeter to measure the voltage between pins 7 & 14
of IC1’s socket. Expect a reading of
5V ±5%. Temporarily insert a jumper
shunt on JP1 and measure the voltage again. This time, you should get
the lower reading of 3V ±5%. When
done, remove the jumper, as in the
majority of applications, a 5V supply
is preferred for programming.
If the power supply checks out,
switch off and insert IC1 into its socket.
Naturally, the position of the notched
(pin 1) end of this IC must match that
of the IC socket.
Using it
It doesn’t take a lot of grey matter
to use the SocketBoard. Simply switch
power off, plug your in-system programmer into the AVR ISP connector
(CON2), and insert the microcontroller
to be programmed into the designated
socket. After switching on, the micro
can be programmed following the
instructions supplied with your ISP.
Important: always switch the power
off before inserting or removing a
microcontroller from its programming socket.
Note that 8-pin micros present a special case. Instead of a separate socket,
all 8-pin devices are programmed in
the first 20-pin socket (SK1). In addition, jumper shunts must be installed
on JP2 & JP3 to route signals to the
correct places for these diminutive
devices.
After programming an 8-pin device,
the two jumper shunts (JP2 & JP3)
should be removed if you also intend
to program 20-pin devices in the same
socket. This ensures that there is no
possibility of damage to the larger
devices.
If a faulty micro is inserted in a
socket or if a working device is inserted
backwards, the current-limit function
will swing into action. In most cases,
the current passed through the part
should not be destructive – if the problem is noticed right away and power
SC
is switched off!
Warning!
Programming the “reset disable”
fuse present on some smaller AVR
devices disables the RESET input,
with the side effect of preventing further programming via the SPI port. In
other words, you’ll no longer be able
to use your in-system programmer
to erase, read, write or verify the affected part.
To restore SPI access, the device
must be erased on a parallel programmer, high-voltage serial programmer
or JTAG programmer, depending on
the device in question. Do not experiment with fuse settings unless you
know exactly what they do!
siliconchip.com.au
|