Description: This project outlines the construction of a simple programmer for the Atmel ATmega8 single-chip microcontrollers. It is categorized as a "hobby grade" programmer, as it does not utilize a variable Vcc and employs the "Serial Programming Algorithm." The ATmega8 can be configured (via programmable fuses) to disable the Serial Programming mode. Once disabled, a parallel programmer is necessary to re-enable the serial programming fuse. The programmer's hardware comprises a 28-pin socket for the ATmega8 and a 14-pin header for connecting to the SBC2's onboard 65C22. This setup can be adapted for use with any 65C22. The ATmega8 utilizes five pins for serial programming (in addition to Vcc and Gnd): Port Pin Function Description J1 PIN PORT PB5 19 (sck) shift clock 5 11 PB1 PB4 18 (MISO) data output 3 12 PB2 PB3 17 (MOSI) data input 4 10 PB0 PC6 1 (/RES) /Reset 9 16 PB6 PB6 9 (CLK IN) External Clock 10 17 PB7. The ATmega8 requires a valid clock input during programming. If the fuses are set to use an external clock source, one must be provided. The 65C22 Timer 1 output through PB7 is chosen to supply the clock, ensuring a valid clock is consistently present. Consequently, Port B of the 65C22 is utilized to access the programmer. Programming the ATmega8 involves placing the chip into RESET and applying serial commands and data to the data input pin while clocking the SCK pin. Data read back from the chip is clocked in on the data output pin. Commands are available to read and write program memory, EEPROM memory, and the configuration area (fuse bytes, lock bits, signature bytes, and calibration bytes). Since the AVR Development tools generate an Intel-Hex formatted output file, a modified version of Ross Archer's "Intel Hex Downloader" is incorporated for seamless operation.
The circuit design for the ATmega8 programmer is structured around the Atmel ATmega8 microcontroller, which is housed in a 28-pin DIP socket. The core functionality relies on the serial programming interface, which utilizes specific pins on the ATmega8 for data transfer and control signals. The programming interface is connected to the 65C22 VIA (Versatile Interface Adapter), which serves as the communication bridge between the programmer and the ATmega8.
The pin configuration is as follows:
- PB0 (MISO) is used for data output from the ATmega8.
- PB1 (MOSI) serves as the data input pin.
- PB2 (SCK) functions as the shift clock signal.
- PB6 (/RESET) is used to reset the ATmega8 during programming.
- PB7 provides the external clock input, sourced from Timer 1 of the 65C22.
During the programming process, the ATmega8 is placed in a reset state, and serial commands are transmitted to the microcontroller. The SCK pin is toggled to clock the data into the ATmega8, while the MISO pin outputs the data back to the programmer for verification. The programming operations include writing to flash memory, EEPROM, and setting configuration fuses.
The memory map for programming is defined as follows:
- Program data is written from address $1000 to $2FFF.
- EEPROM data is programmed from $3000 to $31FF.
- Memory lock bits are accessed at $3200, with fuse bytes located at $3201 (low byte) and $3202 (high byte).
- During verification cycles, data read from the ATmega8 is stored in designated memory locations, with program data occupying $4000 to $5FFF and EEPROM data from $6000 to $61FF.
The circuit can be powered by a stable 5V supply, with appropriate decoupling capacitors placed near the power pins of the ATmega8 to ensure reliable operation. The programming commands and data can be sent via a user interface, which allows for operations such as writing, comparing memory contents, and performing chip erase functions. The incorporation of the Intel Hex downloader facilitates the transfer of program data in a standardized format, enhancing compatibility with existing development tools.
Overall, this programmer design provides a practical solution for hobbyists and developers working with the ATmega8 microcontroller, enabling efficient programming and debugging capabilities.This project describes how to build a simple programmer for the Atmel ATmega8 single-chip microcontrollers. This should be considered a "hobby grade" programmer as it does not use a variable Vcc and uses the "Serial Programming Algorithm.
" The ATmega8 can be configured (through programmable fuses) to disable the Serial Programming mode. Once di sabled, a parallel programmer is required to re-enable the serial programming fuse. The programmer hardware consists of a 28 pin socket for the ATmega8 and a 14 pin header for connecting to the SBC2`s onboard 65C22. Please note that this can be adapted for use with any 65C22. The ATmega8 uses 5 pins for serial programming (in addition to Vcc and Gnd): Port Pin Function Description J1 PIN PORT PB5 19 (sck) shift clock 5 11 PB1 PB4 18 (MISO) data output 3 12 PB2 PB3 17 (MOSI) data input 4 10 PB0 PC6 1 (/RES) /Reset 9 16 PB6 PB6 9 (CLK IN) External Clock 10 17 PB7 The Atmega8 requires a valid clock input during programming.
If the fuses are set to use an external clock source, then one will need to be provided. I chose to use the 65C22 Timer 1 output through PB7 to supply the clock. This ensures a valid clock is always present. Therefore, we will use Port B of the 65C22 to access the Programmer. Programming the ATmega8 is done by placing the part into RESET and applying serial commands and data to the data in pin while clocking the sck pin. Data read back from the part is clocked in on the data out pin. There are commands to read and write program memory, EEPROM memory, and the configuration area (fuse bytes, lock bits, signature bytes, and calibration bytes).
Since the AVR Development tools create an Intel-Hex formatted output file, I decided to incorporate a modified version of Ross Archer`s "Intel Hex Downloader" which allows for seemless operation. ;= ; | ; SSSSSSS BBBBBB CCCCCC 222222 | ; S S B B C C 2 2 | ; SS B B C 2 | ; SSSS BBBBBBB C = 2 | ; SS B B C 2 | ; S S B B C C 2 | ; SSSSSSS BBBBBBB CCCCCCC 22222222 | ; | ;= ;//*// ;// Routine to program a ATMega8 using 5 lines from a 65C22 VIA // ;// By Daryl Rictor (c) Dec 19, 2003 // ;//*// ; ; VIA - FUNCTION - ATMega8 ; PB0 - MISO - PB4 (ATM8 data out) ; PB1 - MOSI - PB3 (ATM8 data in) ; PB2 - SCK - PB5 ; PB6 - /RESET - PC6 ; PB7 - OSC in - PB6 (System Clock) ; ; This is a hobby-grade programmer using the LV serial programming algorithm.
; ; Program Data is loaded from $1000 - $2FFF (16 bits, lo, hi) ; EEPROM data is loaded from $3000 - $31FF (8 bits) ; Memory Lock bits are loaded @ $3200 (6 bits) ; Fuse Lo Byte is loaded @ $3201 (8 bits) ; Fuse Hi Byte is loaded @ #3202 (8 bits) ; During compare cycles, data read from the ATMega8 is stored here: ; Program Data is loaded into $4000 - $5FFF (16 bits, lo, hi) ; EEPROM data is loaded from $6000 - $61FF (8 bits) ; Memory Lock bits are loaded @ $6200 (6 bits) ; Fuse Lo Byte is loaded @ $6201 (8 bits) ; Fuse Hi Byte is loaded @ #6202 (8 bits) ; Signature & Calibration bytes are stored at $6203-$6209 (read only) ; $6203 <- Signature byte 1 ; $6204 <- Calibration byte 1MHz ; $6205 <- Signature byte 2 ; $6206 <- Calibration byte 2MHz ; $6207 <- Signature byte 3 ; $6208 <- Calibration byte 4MHz ; $6209 <- Calibration byte 8MHz ; ; ; MENU OPTIONS ; ; 1 - Write Flash Memory ; 2 - Compare Flash Memory (read back stored in $4000-$5FFF) ; 3 - Write EEPROM Data ; 4 - Compare EEPROM Data (read back stored in $6000-$61FF) ; 5 - Write Lock Bits and Fuse Data ; 6 - Compare Lock Bits and Fuse Data (read back stored in $6200-$6202) ; 8 - Fill Mem with $FF`s ; 9 - Chip Erase Flash & EEPROM ; L - Do Intel Hex download (offset to $1000) ; Q - Quit ;//* ; VIA definitions ;//* Via1DDRB = $7F52 ; Data Direction Register B Via1PRB = $7F50 ; Port B Data Register Via1T1CL = $7F54 ; Timer 1 Latch High Via1T1CH = $7F55 ; Timer 1 Latch Low Via1ACR = $7F5B ; VIA Aux Control Reg DIN = $01 ; Port B - data in pin DOUT = $02 ; Port B - data out pin SCK = $04 ; P
A Microchip PIC12C508 8-pin CMOS microcontroller controls a night light, turning it on and off at preset times every day. It is designed to save energy, produce no electromagnetic interference (EMI), and operate without batteries, featuring a built-in lamp fixture...
This page is a work in progress. The board and source files will soon be available for building and programming to play custom songs. After assembling the board, communication with the programmer was verified, and both the LED and switch...
The gap between TTL (Transistor-Transistor Logic) devices and personal computers can be effectively bridged with modern microcontrollers. These microcontrollers not only incorporate a central processing unit (CPU) but also include program and data memory, EEPROM, input/output (I/O) ports, timers, and...
The microcontroller used is 0822 zilog encore! 8k series (soic,28pin) as shown on the figure. Is a programmable microcontroller, the functions used are the GPIO and the UART of the chip. GPIO is used on led indicators, and the UART...
The ability to turn electrical devices ON or OFF using a remote control is a well-established concept, with numerous devices effectively performing this function.
To implement a remote control system for switching electrical devices, a typical schematic would include several key...
This document discusses the use of small microcontrollers, such as those from the PIC and Atmel series, which typically operate at 5V and require less than 100mA for complete system functionality. Some PICs can function at lower voltages, such as...
There are several methods to read multiple switch inputs using a reduced number of microcontroller unit (MCU) pins. One approach involves using an analog MCU pin to read multiple switches by assigning a unique voltage to each switch through a...
Function generators are essential in the design, testing, and operation of encoders, modulators, demodulators, and measurement instruments. This document presents an economical method to construct a bus-controlled sinewave oscillator that exhibits exceptionally low distortion. The circuit produces a sinusoidal output...
The switch control system utilizes sensors to inform the microcontroller of the trains' positions on the layout. This ensures that only one train occupies the main line at any given time and that switches are correctly set for the train's...
We use cookies to enhance your experience, analyze traffic, and (if you allow) serve personalized ads.
By clicking Accept All, you agree to our use of cookies.
Learn more