Manual AVRupl
Manual AVRupl
micro-controller using the popular Atmel ATMega32 micro-controller. The Controller board
includes no more than is absolutely necessary for a basic controller, thus keeping the cost and
board size to a minimum. All of the individual pins have been brought out to standard .1” spaced
headers to accommodate interfacing to almost any kind of circuitry.
It is designed for use in applications ranging from robotics to industrial controller applications.
PARTS LIST
Check each part against the following list. Make a check in the space provided (√ ) as you identify
each part. The parts may vary slightly from the picture. Any part that is individually packaged
with a part number on it should be kept in its package after it is identified until you use it. Save all
packaging material until all parts have been located.
To order a replacement part, contact the seller of this kit and indicate the model, value, and a
description of the part to be replaced.
Each circuit part in this kit has its own circuit component number (R2, C1, etc.). Use these
numbers when you want to positively identify the same part in the various sections of the Manual.
These numbers, which are especially useful when a part has to be replaced, appear:
A1 ( ) 1 2200 (red-red-red) R1
A1 ( ) 2 10 k(brown-black-orange) R2, R3
Page 1 of 11
KEY QTY DESCRIPTION CIRCUIT #
CAPACITORS
A2 ( ) 1 10 F 50 Volt C1
A3 ( ) 2 .1 F Monolithic Ceramic C2, C3
INTEGRATED CIRCUITS
C1 ( ) 1 AT Mega 32 U1
C2 ( ) 2 78L05 U2, U3
SOCKETS-CONNECTORS
D1 ( ) 1 40-Pin IC Socket
D2 ( ) 1 2-Pin Power Header
D3 ( ) 1 10-Pin ISP Header
D4 ( ) 3 20-Pin Pin Header
D5 ( ) 1 2-Pin Pin Header
D6 ( ) 1 Battery 2-Pin Socket
D7 ( ) 1 Battery Snap Connector A1
MISCELLANEOUS
E1 ( ) 1 Reset Switch
E2 ( ) 1 Circuit Board
A3 B1 A2
C1 C3 D1
Page 2 of 11
D2 D3 D4
D5 D6 D7
E1 E2
Page 3 of 11
ASSEMBLY NOTES
The illustrations in this Manual are called Pictorials and Details. Pictorials show you the result of
performing a group of assembly steps. Details generally show how to perform a single step.
When you are directed to refer to a certain Pictorial “for the following steps,” continue using that
Pictorial until you are referred to another Pictorial for another group of steps.
Read the entire step before you perform the operation; then follow the instructions carefully.
Position all parts as shown in the Pictorials.
Install the components on the component (lettered) side of the circuit board in the circuit board
Pictorials and then solder the leads to the foil side. Resistors are designated by their resistance
value in (ohms), k (kilohms), or M (megohms) and color code. Capacitors will be designated
by their capacitance value (in pF and F) and type (disc, tantalum, or electrolytic). Position all
electrolytic and tantalum capacitors only as shown.
Due to the small foil area around the circuit board holes and the small areas between foils, use the
utmost care to prevent solder bridges between adjacent foil areas. Use only a minimum amount
of solder and use no larger than a 40-watt soldering iron with a small tip. Allow it to reach
operating temperature, and then apply it only long enough to make a good solder connection.
Wipe the soldering iron tip often on a damp cloth or sponge. It is a good habit to wipe the iron
each time you solder a group of connections. The soldering tip must be clean of oxidation and
have a bright thin solder coat.
SAFETY WARNING: Avoid eye injury when you cut off excess lead lengths. Hold the leads so
they cannot fly toward your face or eyes, and be sure to wear protective eye gear.
Page 4 of 11
SOLDERING NOTES
A GOOD SOLDER CONNECTION
SOLDER BRIDGES
Page 5 of 11
INITIAL TESTS
Connect the battery connector to the M32 controller board and attach it to a 9 Volt battery. You
should see the LED light. If not, then remove the battery immediately and proceed to the “In Case
of Difficulty” section.
The M32 is shipped with a program installed that will increment each of the ports from 0 to 255
and then start over again. When the M32 is first powered up, you should see the port pins on
each port increment in binary.
To remove this program, simply erase the Flash memory area using one of the many software
tools available for the Atmel AVR series of microprocessors.
OPERATION
The M32 controller board is intended for use with almost any of the AVR programming tools
available. We recommend Bascom AVR, available from MCS Electronics. This software is
available in a “demo” version that limits the output to 2k of compiled code. This is more than
enough to test and demo the M32. You can contact MCS Electronics on the web at:
http://www.mcselec.com. Since the M32 can handle up to 32k of compiled code, you will want to
consider purchasing the full version from one of the distributors listed at:
http://www.mcselec.com/reseller.htm
WinAVR is a set of tools released under the GNU GPL license that comprise a C development
suite for AVR microcontrollers. The install is available at: http://sourceforge.net/projects.winavr/
Of course you can always download the AVR Studio from Atmel directly. This software is free and
allows you to program, simulate, download and run your software written in the AVR assembly
language. You will find the AVR Studio at http://www.Atmel.com
The ISP (In System Programmer) connection is compatible with most programmers using the
standard 10-Pin ISP interface. This is found on the STK-500, STK-200, and several other
programmers available today. You can also purchase our optional ISP Programmer that is also
compatible with all of our microcontroller boards.
Page 6 of 11
IN CASE OF DIFFICULTY
Problem Check
LED will not light Battery connected properly Battery connectors making contact with the
2-Pin Battery connector Red and Black wires reversed 78L05 Regulator
(U2) not functioning
Port Pins not 78L05 Regulator (U2) not working Poor solder connections on the 20-Pin
displaying logic header ATMega32 chip not installed or installed incorrectly Program
or changing has been erased from the ATMega32 chip Fuse settings incorrect in the
ATMega32 chip
SPECIFICATIONS
CIRCUIT DESCRIPTION
The heart of the M32 Controller board is the Atmel ATMega32 microcontroller chip. The board
provides a regulated 5V power supply from the power connector. The board also provides an
additional separate regulated 5V power supply intended for peripherals and any other “off-board”
modules. The raw power input is also available on the power distribution bus and can be used for
any peripherals that do not require a regulated 5 Volt supply. The ISP connector utilizes the ISP
pins of the ATMega32 in the industry standard pin-out. I2C connections are located on the board
and provide individual pull-up resistors for the SCL and SDA lines. These are not directly
connected to the ATMega32 chip, but are brought out to two additional pins for optional
connection to pins 22 and 23 of the ATMega32 chip. The I2C pins provide Ground, + 5 Volts, and
the SCL and SDA lines. A momentary reset switch has been connected directly to pin 9 of the
ATMega32 chip.
Please see the Atmel ATMega32 Datasheet for additional details on programming and operation of
the ATMega32 chip.
Page 7 of 11
M32 PIN-OUT WORKSHEET
The M32 Pin-out Worksheet is very handy for identifying the various pins used on the M32 with
your own names. These can then be the same names that are referenced in your software
program for the M32. Make a few copies of this page for future use.
______________PB0 1 40 PA0______________
______________PB1 2 39 PA1______________
______________PB2 3 38 PA2______________
______________PB3 4 37 PA3______________
______________PB4 5 36 PA4______________
______________PB5 6 35 PA5______________
______________PB6 7 34 PA6______________
______________PB7 8 33 PA7______________
_____________RESET 9 32 AREF_____________
______________VCC 10 31 GND______________
______________GND 11 30 AVCC_____________
_____________XTAL2 12 29 PC7______________
_____________XTAL1 13 28 PC6______________
______________PD0 14 27 PC5______________
______________PD1 15 26 PC4______________
______________PD2 16 25 PC3______________
______________PD3 17 24 PC2______________
______________PD4 18 23 PC1______________
______________PD5 19 22 PC0______________
______________PD6 20 21 PD7______________
Page 8 of 11
PROGRAMMING THE M32
The following steps assume that you have installed Bascom. If you are using a different compiler,
follow the directions given with that compiler.
To test the device, launch Bascom, click on Options/Programmer and select the STK200/STK300
Programmer from the drop-down list – You only need to do this once. Next, select
Options/Compiler/Chip and select the M32 from the drop-down list, then click OK.
Now type in the following program that will flash an LED connected to PB0 on the M32:
Do 'Create a loop
Toggle Portb.0 'Toggle PB0 High/Low
Wait 1 'Wait 1 Second
Loop 'Repeat
End
Compile the program by selecting Program/Compile or by pressing the F7 key. If no errors occur,
load the program into the M32 by selecting Program/Send to Chip or by pressing F4. A dialog box
similar to Figure 1 should appear. Notice that it
has identified the chip as an M32.
Page 9 of 11
ORIGINAL M32 FUSE SETTINGS (These are not the defaults from Atmel)
Please note that if you re-program some of the various “fuses” in the M32, this can cause the
micro-controller to become non-responsive. Use extreme care and read the datasheet carefully
before changing any of the ATMega32 fuse bits. If your micro-controller becomes non-responsive,
you will need to use a “parallel” programmer (such as the STK-500 from Atmel) to set the fuses
back to their original configuration.
The fusebits of the ATMega32 control various aspects of the microcontroller. For most, the
default settings do not need to be changed. For advanced users, the fusebits can be changed to
allow for higher speeds using an external ceramic resonator.
Table 1 below shows the default M32 fusebit settings (not the factory defaults). Table 2 shows the
settings for using an external ceramic resonator up to 16mhz.
Fusebits Fusebits
Fusebit C 0:BODLEVEL 4.0V Fusebit C 0:BODLEVEL 4.0V
Fusebit B 1:BODEN disabled Fusebit B 1:BODEN disabled
Fusebit KL 00:6CK, BOD enabled Fusebit KL 00:6CK, BOD enabled
Fusebit 0100:Internal RC oscillator 8 Fusebit 1110:Ceramic
A987 MHz A987 Resonator/Crystal, fast rising
power
Fusebits High
Fusebit I 1:OCDEN fuse unprogrammed Fusebits High
Fusebit H 1:JTAG disabled Fusebit I 1:OCDEN fuse unprogrammed
Fusebit Q 0:Serial programming enabled Fusebit H 1:JTAG disabled
Fusebit P 1:osc. options not programmed Fusebit Q 0:Serial programming enabled
Fusebit G 1:Erase EEPROM when chip Fusebit P 0:osc. options programmed
erase Fusebit G 1:Erase EEPROM when chip
Fusebit FE 00:2048 words boot size erase
Fusebit D 1:Reset vector is $0000 Fusebit FE 00:2048 words boot size
Fusebit D 1:Reset vector is $0000
Table 1 - Default M32 Settings
Table 2 – External Resonator Settings
An external ceramic resonator can be added to the M32. This allows for higher speeds up to
16mhz and better accuracy. A standard 3-pin ceramic resonator can be soldered into the 3-holes
indicated as X1 on the M32. Once this is soldered into place, change the fusebit settings as
indicated in Table 2 and save the fusebits & fusebits high.
Page 10 of 11
M32 CONTROLLER CONNECTORS
The M32 is designed to use .1” square crimp header connectors and
housings to make both I/O and power connections. These are available
at our web site or various electronics suppliers.
TIP: You can use 28-gauge stranded twisted-pair wire from Cat-5 cable
with the crimp connectors
Page 11 of 11