Prototype Board for Atmel Mega644
Introduction
This page describes a prototype board for the Atmel Mega644 or Mega32 (PDIP) MCU. It includes
a power supply, crystal clock, and generous bypass capacitors.
A six-pin header allows flash memory programming from an STK500 or AVRISPmkII. All port pins are brought out to a single row of vias on 0.1 inch centers. A single 34 connection, SIP header plug could be used to attach ths row to another board or to a solderless breadboard. All 32 port pins, plus Vcc, and ground, are available. A separate interface is provided for serial communication.
Board Version 12 for 2012
The board layouts are shown below. The design for next revision (v13-2013): main board, usb board, serial board.
The ExpressPCB design files above require a free software download to modify or to order directly from expressPCB.
Note that the schematic includes both the serial and USB interfaces, but you would never use more than one at a time.
The main board.
The four-pin header to the right of the board matches either the serial or USB board below (and in the future a radio board).
The board is 0.3 inches shorter than the last model because header pins for Aref and VccUSB were deleted along with the solder pads for the
TSSOP USB chip.
Instructions for building the board are below.
The USB and serial boards.
Build ONE of these ONLY IF you need serial communication. Instructions for building the boards are below.
Note that VccUSB is brought out to a pin on the board, but DOES NOT connect to Vcc on the main board.
When using the serial-USB connection:
- You must turn off the microcontroller, then:
- Plug in the usb cable. The PC should recognize a USB serial connection.
- Then: turn on the microcontroller.
The UART to USB board:
The UART to serial board:
The populated boards showing the headers (on the bottom) which attach the boards to the main cpu board.
A top view of the boards is below.
Version 12 Construction suggestions:
Study the photo below before you build. There are more photos of very similar
(but older) boards near the end of the page.
Generally mount the thinnest components first because the tall components
get in the way of soldering flat components.
- Solder all capacitors and resistors on the board.
See Hints
and Tips for prototyping with Surface Mount Devices. Also good is SMT101.
Note that there is one 1.0 uf capacitor (below the regulator) and two 22pf capacitors below the crystal. The rest are 0.1 uf.
- Add the headers for TX, RX, LED, Vcc-Vtg, and programming.
For the progamming header, use one two-row header, not two single-row headers.
- Add the regulator, power switch and power plug and diode.
- If you are going to hardwire a battery to the board, then don't mount
the power plug.
- You could add a remote power switch, rather than mount one on the board.
- The power switch should lay flat, it should not be on edge
(see photos).
- Test the power supply before you go any further! Vcc should be 5 volts +/-0.05 volts.
Note that this board (unlike the STK500) requires 9-12
volts, DC, with positive on the power connector center pin.
This
year's version puts a 1N40001 diode between the positive power input and
the switch. The diode ensures that the system is not destroyed by reverse polarity (but it does not work).
- Add the MCU socket.
Always
use a socket for the MCU.
- Add the 16 MHz (or 20 MHz) crystal.
- You can add an (optional) reset button by connecting a normally-open pushbutton
between the two small vias to the right of the programming header.
When you
close the pushbutton, you short the RESET pin to ground.
- I strongly suggest adding the LED and jumper for debugging. Toggling
port pin D.2 will flash the LED to let you know that the MCU is running.
- For a Mega644 with serial or USB adaptor, this GCC program (and uart.c and uart.h) will test the system by blinking the LED, sending numbers to the terminal and accepting single keystrokes from the terminal.
- For the Mega644, with just the LED is on the board, then this
GCC program (project
zip) will test the system by blinking the LED.
- For the Mega32, if the LED is on the board, then either this
GCC program or this Codevision program will
test the system.
- If you need serial communication then you can use either USB or RS232 interfaces.
- USB: Solder the FT232RL TSSOP part to the board ONLY if you need serial communication via USB.
I think the best way to do this is:
- wipe the solder lands with a flux pen.
- place the TSSOP part on the lands and tack the end leads with a soldering iron, but using no excess solder.
- use a soldering iron to melt the tin on the solder lands onto the leads, using now new solder.
- check the connection by gently wiggling each lead and/or test for continuity with an ohm meter.
- fix any unsoldered leads by touching with a soldering iron.
- use water or isopropyl alcohol to wash the flux off the board (optional).
- Add the 1K resistors and capacitor.
- Add the USB type B socket. NOTE: apply electrical tape to the metal bottom of the socket to avoid shorting two traces.
- When using the serial-USB connection:
- you must turn off the microcontroller
- plug in the usb cable
- then turn on the microcontroller.
- Note that VccUSB is brought out to a pin on the board (top-right), but should notconnect to Vcc on the main board.
A
- RS232: If you want to use RS232 use the following small board.
The small RS232 board requires a 1uf capacitor, a MAX233 and a DB-9 connector.
Always use a socket for the MAX233.
Setting Aref
The A/D converter reference voltage, Aref, can be set (Bits 7:6, REFS1:REFS0
of ADMUX) to 5.00, 2.56, or 1.1 volts.
You do not need to connect the Aref
pin externally, unless you want to use some custom reference voltage.
REFS1 |
REFS0 |
Voltage Reference selection |
0 |
0 |
Requires an external voltage (1<Vref<Vcc) applied to AREF pin
(not used on proto board) |
0 |
1 |
Internal reference Vref = Vcc (with external bypass capacitor supplied
on proto board) |
1 |
0 |
Internal reference Vref = 1.1±0.1 volts (with external bypass
capacitor supplied on proto board) |
1 |
1 |
Internal reference Vref = 2.56±0.2 volts (with external bypass
capacitor supplied on proto board) |
Programming the board
You can flash the microcontroller using a AVRISPmkII programmer also as shown below.
You will need to mount the Vcc-Vtg jumper.
Test the MCU programming and execution by blinking the LED.
When attaching devices
to the MCU, remember that port pins B.5, B.6 and B.7 are used by the
programmer.
If you drive these pins from an external source (such
as the LCD display), the chip will not program!
You can flash
the chip from the STK500 as shown in the picture below.
You will need to unmount the Vcc-Vtg jumper.
When attaching devices
to the MCU, remember that port pins B.5, B.6 and B.7 are used by the
programmer.
If you drive these pins from an external source (such
as the LCD display), the chip will not program!
Useful parts
Parts list (Digikey part numbers):
- Mega644-20PU or MEGA32-16PC Atmel microcontroller
- MAX233CPP dual RS232 interface or FT232RL
- A2100-ND RS232 connector socket
- ED2983-ND or 609-1039-ND or sparkfun PRT-00139 USB-B socket
- LM340LAZ-5.0 regulator
- CTX077 16 MHz crystal
- Switch SPDT surface mount 401-2012-1-ND
- 2.1 mm power plug CP-002A-ND
- 9 volt battery clip 84-6k-ND
- All resistors and capacitors are 1206 surface-mount packages
Other useful part numbers:
- SIP machine pin plug (m-m) Digikey ED2064-ND, or Sparkfun PRT-00117
- SIP machine pin socket (f-m) Jameco 78642 or All Electronics SIP-30
- Single row header plug (m-m) Digikey WM6436-ND or All Electronics SHR-40
- Dual row header plug (m-m) Jameco 203888: All Electronics DHS-40
- Dual row header socket (f) Digikey 929975-01-36-ND
- Single row header socket (f) Digikey 929974-01-36-ND
- Radio Shack and Futurlec (Proto777) have good, cheap solder boards
- Flat flex 2-pin cable Digikey a9bba-0204f-nd
- 10k trimpots Digikey 3386f-103-nd
- Digikey custom cable connector (10 pin header socket to 14 pin DIP plug) RCC-1602-ND
- SparkFun has F-F jumpers (one SKU#: PRT-08430 and two wire SKU#: PRT-08614) and 2x5 IDC cables SKU#: PRT-08535.
- http://www.sensitronics.com/index.htm (thin film force sensors) has a sample page
- vibration/flex sensor MSP1006-ND or MSP1007-ND digikey search on "piezo film"
ECE476 parts checkist
- RCA cables
- power supplies
- spools wire (at least 5 colors)
- solder stations -- solder/irons/magnifiers/glasses/lights
- two wire connectors
- 2x16 lcds -- about 30
- 9 v battery/clips
- electrial tape
- duct tape
- 40 pin sockets
- alligator clips/RSR
- white board/RSR
- 16 MHz crystals
- solder boards/RSR
- red/green/yel LED
- lm358
- 4001 diodes
- 2n3904/3906
- 4N35
- 22 pf caps
- 10k trimpots
- small screwdrivers
- wire stripers
- pliers
- rs232 straight-thru 6ft
Old versions
Version 11
The board layout is shown below. The ExpressPCB design file for v11/2011 is here and requires a free software download to modify or to order directly from expressPCB. Minor changes from last year include bigger diameter header vias, 1N4001 diode on power input, and Vcc-to-Vtarget jumper support for the AVRISP programmer. Major change is conversion from serial to USB connection for debugging.
Study the photo below before you build. There are more photos of very similar
(but older) boards near the end of the page.
Generally mount the thinnest components first because the tall components
get in the way of soldering flat components.
- If you need serial communication then you can use either USB or RS232 interfaces.
- USB: Solder the FT232RL TSSOP part to the board ONLY if you need serial communication via USB.
I think the best way to do this is:
- wipe the solder lands with a flux pen.
- place the TSSOP part on the lands and tack the end leads with a soldering iron.
- use a hot air soldering unit to melt the tin on the solder lands onto the leads.
- check the connection by gently wiggling each lead and/or test for continuity with an ohm meter.
- fix any unsoldered leads by touching with a soldering iron.
- use water or isopropyl alcohol to wash the flux off the board.
- RS232: If you want to use RS232 then DO NOT add the TSSOP part or the USB connector, and instead use the following small board.
The small RS232 board requires a 1uf capacitor, a MAX233 and a DB-9 connector. Schematic.
- Next, solder all capacitors and resistors on the board.
See Hints
and Tips for prototyping with Surface Mount Devices. Also good is SMT101.
Note that there is one 1.0 uf capacitor (below the regulator) and two 22pf capacitors below the crystal. The rest are 0.1 uf.
- Add the headers for TX, RX, LED, Vcc-Vtg, and programming. For the progamming header, use one two-row header, not two single-row headers.
- Add the regulator, power switch and power plug and diode.
- If you are going to hardwire a battery to the board, then don't mount
the power plug.
- You could add a remote power switch, rather than mount one on the board.
- The power switch should lay flat, it should not be on edge
(see photos).
- Test the power supply before you go any further! Vcc should be 5 volts +/-0.05 volts.
Note that this board (unlike the STK500) requires 9-12
volts, DC, with positive on the power connector center pin.
This
year's version puts a 1N40001 diode between the positive power input and
the switch. The diode ensures that the system is not destroyed by reverse polarity (but it does not work).
- Add the MCU socket.
Always
use a socket for the MCU.
- Add the 16 MHz (or 20 MHz) crystal.
- Add the USB type B socket.
- You can add an (optional) reset button by connecting a normally-open pushbutton
between the two samll vias to the right of the programming header. When you
close the pushbutton, you short the RESET pin to ground.
- I strongly suggest adding the LED and jumper for debugging. Toggling
port pin D.2 will flash the LED to let you know that the MCU is running.
- For a Mega644 with serial or USB adaptor, this GCC program (and uart.c and uart.h) will test the system by blinking the LED, sending numbers to the terminal and accepting single keystrokes from the terminal.
- For the Mega644, with just the LED is on the board, then this
GCC program (project
zip) will test the system by blinking the LED.
- For the Mega32, if the LED is on the board, then either this
GCC program or this Codevision program will
test the system.
- When using the serial-USB connection:
- you must turn off the microcontroller
- plug in the usb cable
- then turn on the microcontroller.
Version 8
The board layout is shown below. The ExpressPCB design file for v8/2009 is here and requires a free software download to modify or to order directly from expressPCB. The ExpressPCB schematic file is here. Minor changes from last year include bigger diameter header vias, 1N4001 diode on power input, and Vcc-to-Vtarget jumper support for the AVRISPmkII programmer.
The ExpressPCB design file for v7/2008 is here.
The ExpressPCB design file for v3/2006 is here and requires a free software download to modify or to order directly from expressPCB.
.
Images of the Revision 2 board (Spring 2005). The Rev2 board has solder mask, silk screen
and slightly improved placement of lettering. It also has one more connection
to port pin D7.
Images of the Revision 1 prototype board with MCU and RS232 interface mounted.
Copyright 2006- Cornell University