
AVR301
3
Figure 2.
I
2
C Start and Stop Bits
The AT17C010 device is programmed/verified on a 128-
byte page boundary. During normal FPGA configuration
operations the read of the device starts at address 0 and
continues until the FPGA has completed its configuration.
The routines WritePage and ReadPage write and read
128-byte pages from the configuration memory and use the
generic I
2
C routines to perform this function. WritePage
and ReadPage are both called with the page address to
write/read to, and a pointer to a 128-byte page buffer. At
the end of a page write the data polling method is used to
determine the end of the internal page programming cycle.
ProgramResetPolarity and VerifyResetPolarity write and
read data from memory locations 0x20000 - 0x20003 in
effect setting and verifying the reset/oe polarity.
PORTB on the AT90S8515 is used to communicate with
the FPGA configuration memory. Bit assignments are as
follows:
/*PB0 = SDA*/
/*PB1 = SCL*/
/*PB2 = SER_EN - used to put AT17C010 in I2C mode*/
/*PB3 = CS*/
/*PB4 = RESET/OE*/
The routine Init.c initializes the AT90S8515 peripherals.
Routines Timer0.c and Timer1.c are general-purpose time
out routines. Main is used to call WritePage, ReadPage,
ProgramResetPolarity, and VerifyResetPolarity and serves
to illustrate proper calling conventions for those routines.
Modifications and Optimizations
Impact on Changing Crystal Frequency
If the user decides to change oscillator frequencies then
the following routines would have to be modified:
BitDelay
ProgramResetPolarity
SetSCLHigh
WritePage
BitDelay uses NOP
’
s to effect a quarter bus period delay.
Add or remove NOP
’
s to increase or decrease the delay.
In the routines ProgramResetPolarity and WritePage timer
1 is used to generate a time-out after 20 milliseconds, the
programming operation should have completed by then.
Timer 0 is used in SetSCLHigh to generate a time out after
35 microseconds. If the SCL line is not high by then, then
something is wrong on the bus.
References
The I
2
C Bus and How to use it, April 1995 Update - Philips
Semiconductors
Programming Specification for Atmel
’
s Configuration Mem-
ory EEPROMS - Atmel Corporation
AT17C512/LV512/010/LV010 FPGA Configuration Memory
Datasheet - Atmel Corporation
AT90S8515 Datasheet - Atmel Corporation
Table 2.
Code Size and Execution Time for Page
Read/Write
Routines
Cycles
Bytes
WritePage
287872
146
ReadPage
145901
126
ProgramResetPolarity
156104
106
VerifyResetPolarity
157269
98
START Condition
SCL
SDA
STOP Condition
SCL
SDA