This is revision B of the Mega1 module.

Mega1 Module (Revision B)

Table of Contents

1. Introduction

The Mega1 module can accept one of the many available 28-pin microcontrollers from Microchip® and Atmel.

This module has the following features:

This board supports the following Atmel microcontrollers:

2. Programming

You are free to program the microcontroller using any technology that you want. Two techniques are described here:

External Programmer
An external programmer can be used to program the microcontroller.
Downloader
A downloader executive can be programmed into the microcontroller, and programs can be loaded into the microcontroller via one of the serial communications connectors.

All terminal mode programs have the most significant bit cleared (i.e. plain ASCII) and all of the host commands start with the most significant bit set. This is summarized in the table below:

Bit Mode
7 6 5 4 3 2 1 0
0 x x x x x x x Text Mode Command
1 x x x x x x x Host Mode Command

Both terminal mode and host mode are discussed in separate sections below.

2.1 Text Protocol

2.2 Binary Protocol

2.3 Inter Processor Protocol

This level of protocol is not directly accessible to the user. This is just for documentation purposes.

The boot loader of the ATmegaxxx chip is programmed to enable the SPI interface in slave mode. The firmware in the PIC16F688 is programmed to send commands to the ATmegaxxx as an SPI master. This is done by bit banging (technical term.) Each time the PIC sends a command byte down, it gets also gets a byte of data back. The data returned is result of the previous command. There is a handshake line that is toggled after each SPI command is processed on the AVR. By watching the the handshake line, the PIC can not over run the AVR SPI slave command processor.

The command protocol is stateless in that every command is exactly one byte long. Thus, there is no way to get out of synchronization.

The commands are summarized in the table below:

Command
Name
Bit Returns Description
7 6 5 4 3 2 1 0
No-operation 0 0 0 0 0 0 0 0 0000 0000 Do nothing.
Page Power Get 0 0 0 0 0 0 0 1 0000 0ppp Return ppp, the page size as a power of 2.
Address Low Get 0 0 0 0 0 0 1 0 aaaa aaaa Return aaaa aaaa, the low byte of the address
Address High Get 0 0 0 0 0 0 1 1 aaaa aaaa Return aaaa aaaa, the high byte of the address.
Program Byte Get 0 0 0 0 0 1 0 0 pppp pppp Return pppp pppp, the next byte of program memory. Address is incremented.
Address Jump 0 0 0 0 0 1 0 1 0000 0000 Jump to the address.
Page Write 0 0 0 0 0 1 1 0 0000 0000 Page write.
UART Status Get 0 0 0 0 0 1 1 1 0000 00ab Return the UART status as ab.
UART Byte Get 0 0 0 0 1 0 0 0 0000 00ab Return the UART status as ab.
Data Low Set 0 0 0 1 l l l l 0000 llll Set the low 4-bits of data to llll.
Address Low Set 0 0 1 0 h h h h hhhh llll Set the low byte of address to hhhhllll, where llll is from the previous Data Low Set command.
Address High Set 0 0 1 1 h h h h hhhh llll Set the high byte of address to hhhhllll, where llll is from the previous Data Low Set command.
Byte Load 0 1 0 0 h h h h hhhh llll Load hhhhllll into the memory buffer, where llll is from the previous Data Low Set command. The address is incremented.
Module Select 0 1 0 1 h h h h hhhh llll Send hhhhllll out to bus to select a module. llll is from the previous Data Low Set command.
Byte Transmit 0 1 1 0 h h h h hhhh llll Send hhhhllll out to bus as a command/data byte. llll is from the previous Data Low Set command.

3. Hardware

The hardware consists of a circuit schematic and a printed circuit board.

3.1 Circuit Schematic

The schematic for the Mega1 module is shown below:

Mega1 Schematic

The parts list kept in a separate file -- mega1.ptl.

3.2 Printed Circuit Board

The printed circuit board files are listed below:

mega1_back.png
The solder side layer.
mega1_front.png
The component side layer.
mega1_artwork.png
The artwork layer.
mega1.gbl
The RS-274X "Gerber" back (solder side) layer.
mega1.gtl
The RS-274X "Gerber" top (component side) layer.
mega1.gal
The RS-274X "Gerber" artwork layer.
mega1.gml
The RS-274X "Gerber" mask layer.
mega1.drl
The "Excellon" NC drill file.
mega1.tol
The "Excellon" tool rack file.

4. Software

{To be written.}

5. Issues

Any issues that come are listed here.


Copyright © 2005-2009 by Wayne C. Gramlich. All rights reserved.