1
Industry-standar d 2-wire Protocol “Bit-banged” C
Routines for the AVR® Microcontroller/ISP Code
for the AT17CXXX FPGA Configuration Memories
Features
•C Routines for Serial Interface
•Example Circuit for AVR Programming
FPGA Configuration Memories
•No Interrupts
•User Programmable Speed
•Supports Entire AVR® Family
•Supports AT17CXXX and AT24CXXX
Families of EEPROM Devices
Introduction
This ap plication note descri bes how t o
In-System Program (ISP) an Atmel
FPGA Configuration m emory (Configu-
rator) using an Atmel AVR®
Microcon tro ller an d ho w to “b it-ba ng” th e
industry-standard 2 -wire protocol that is
needed to program the Configurator
using port pins on an AT90S8515 AVR
Microcontroller. The AT17C series of
Configurators, ranges in density from
64K bits to 2M bits.
Users should be familiar with
the AT90S8515 and AT17 Series
datasheets and the application
note titled, “Programming Specification
for Atmel’s Configuration Memory
EEPROMS AT17C65/128/256/512/
010/020” . This ap plicati on note i s writte n
specifically for the 1M bit device, but can
be easily modified for other AT17 series
family members. C routin es to read and
write data are included. The code
can easily be recompiled for all AVR
controllers with SRAM.
Theory of Operation
The industry-standard 2-wire protocol
bus is a two-wire synchronous serial
interface consisting of one data (SDA)
and one clock (SCL) line. The industry-
standard 2-wire protocol bus is a multi-
master bus where one or more devices,
capable of taking control of the bus, can
be connected. When there is only one
master connected to the bus, the result-
ing code is much simpler because
handling of bus contentions and inter
master access (a master accessing
another master) is not necessary. Only
master devices can drive both the SCL
and SDA lines while a slave device is
only allowed to issue data on the SDA
line.
Software Description
The generic industry-standard 2-wire
protocol routines listed below were
compiled without optimization using
IAR’s C Compiler Version 1.30A
(http://www.iar.se). These routines
implement a single master, industry-
standard 2-wire protocol implementation
and are available for download from
http://www.atmel.com/atmel/prod-
ucts/prod185.htm. The AT90S8515 used
to perform the master function is clocked
by an exte rnal 7.3728 MH z crystal. The
routine Bit Delay is executed in 15 clock
cycles or a 2.03 µ s period and pr ovides
the quarter period bit timing necessary to
meet the 3.3V timing specifications
found i n the abov e referenc ed Config u-
rator programming application note.
This code uses PORTB of the
AT90S8515. On power-up PORTB is
initialized to all inputs with the internal
pull-ups turned off, the external pull-ups
pull the S DA and S CL lines high a nd the
C Routines for
the
Microcontroller/
AT17CXXX
ISP Code
Application
Note
Rev. 1298A–0 4/2 0/9 9