Sie sind auf Seite 1von 4

Programming the Flash and EEPROM of AT90S2313

Atmels AT90S2313 offers 2K !tes of "n#S!stem Re$rogrammale Flash Program memor! and 12% !tes of
EEPROM &ata memor!'
The AT90S2313 is shi$$ed (ith the On#)hi$ Flash Program and EEPROM &ata memor! arra!s in the erased
state *i'e'+ )ontents , -FF. and read! to e $rogrammed' This de/i)e s0$$orts a high#/oltage *121.
Parallel Programming mode and a lo(#/oltage Serial Programming mode' The 2121 is 0sed for
$rogramming enale onl!+ and no )0rrent of signifi)an)e is dra(n ! this $in' The Serial Programming
mode $ro/ides a )on/enient (a! to do(nload $rogram and data into the AT90S2313 inside the 0sers
s!stem'
The $rogram and EEPROM memor! arra!s in the AT90S2313 are $rogrammed !te!#!te in either
$rogramming mode' For the EEPROM+ an a0to#erase )!)le is $ro/ided
(ithin the self#timed (rite instr0)tion in the Serial Programming mode' &0ring $rogramming+ the
s0$$l! /oltage m0st e in a))ordan)e (ith Tale 22'
Tale 22' S0$$l! 1oltage d0ring Programming
Parallel Programming This se)tion des)ries ho( to $arallel $rogram and /erif! Flash Program memor!+
EEPROM data memor!+ 3o)4 its and F0se its in the AT90S2313'
Signal 5ames
"n this se)tion+ some $ins of the AT90S2313 are referen)ed ! signal names des)riing their f0n)tion
d0ring $arallel $rogramming' Pins not des)ried in the follo(ing tale are referen)ed ! $in names'
See Fig0re 69 and Tale 23' Pins not des)ried in Tale 23 are referen)ed ! $in names'
The 7A187A0 $ins determine the a)tion e9e)0ted (hen the 7TA31 $in is gi/en a $ositi/e $0lse' The it
)oding is sho(n in Tale 26'
:hen $0lsing :R or OE+ the )ommand loaded determines the a)tion e9e)0ted' The )ommand is a !te
(here the different its are assigned f0n)tions as sho(n in Tale 2;'
Fig0re 69' Parallel Programming
Tale 23' Pin 5ame Ma$$ing
Tale 23' Pin 5ame Ma$$ing
1
Tale 2;' <ommand =!te =it <oding
Enter Programming Mode The follo(ing algorithm $0ts the de/i)e in Parallel Programming mode>
1' A$$l! s0$$l! /oltage a))ording to Tale 22+ et(een 1<< and ?5&'
2' Set the RESET and =S $in to @0A and (ait at least 100 ns'
3' A$$l! 11'; # 12';1 to RESET' An! a)ti/it! on =S (ithin 100 ns after 2121 has een a$$lied to
RESET+ (ill )a0se the de/i)e to fail entering Programming mode'
Serial &o(nloading =oth the $rogram and data memor! arra!s )an e $rogrammed 0sing the serial SP"
0s (hile RESET is $0lled to ?5&' The serial interfa)e )onsists of $ins S<K+ MOS" *in$0t. and M"SO
*o0t$0t.' See Fig0re ;3' After RESET is set lo(+ the Programming Enale instr0)tion needs to e
e9e)0ted first efore $rogram8erase instr0)tions )an e e9e)0ted'
Fig0re ;3' Serial Programming and 1erif!
For the EEPROM+ an a0to#erase )!)le is $ro/ided (ithin the self#timed (rite instr0)tion and there is
no need to first e9e)0te the <hi$ Erase instr0)tion' The <hi$ Erase instr0)tion t0rns the )ontent of
e/er! memor! lo)ation in oth the $rogram and EEPROM arra!s into -FF'
The $rogram and EEPROM memor! arra!s ha/e se$arate address s$a)es> -0000 to -03FF for $rogram Flash
memor! and -000 to -0BF for EEPROM data memor!'
Either an e9ternal )lo)4 is s0$$lied at $in 7TA31 or a )r!stal needs to e )onne)ted a)ross $ins
7TA31 and 7TA32' The minim0m lo( and high $eriods for the serial )lo)4 *S<K. in$0t are defined as
follo(s>
3o(> C 2 7TA31 )lo)4 )!)le
Digh> C 2 7TA31 )lo)4 )!)les
Serial Programming Algorithm
2
:hen (riting serial data to the AT90S2313+ data is )lo)4ed on the rising edge of S<K'
:hen reading data from the AT90S2313+ data is )lo)4ed on the falling edge of S<K' See Fig0re ;6+
Fig0re and Tale 29 for timing details'
To $rogram and /erif! the AT90S2313 in the Serial Programming mode+ the follo(ing seE0en)e is
re)ommended *See 6#!te instr0)tion formats in Tale 2%.>
1' Po(er#0$ seE0en)e>
A$$l! $o(er et(een 1<< and ?5& (hile RESET and S<K are set to @0A' "f a )r!stal is not )onne)ted
a)ross $ins 7TA31 and 7TA32+ a$$l! a )lo)4 signal to the 7TA31 $in' "n some s!stems+ the $rogrammer
)annot g0arantee that S<K is held lo( d0ring Po(er#0$' "n this )ase+ RESET m0st e gi/en a $ositi/e
$0lse of at least t(o 7TA31 )!)les d0ration after S<K has een set to @0A'
2' :ait for at least 20 ms and enale serial $rogramming ! sending the Programming
Enale serial instr0)tion to the MOS" *P=;. $in'
3' The serial $rogramming instr0)tions (ill not (or4 if the )omm0ni)ation is o0t of s!n)hroniFation'
:hen in s!n)+ the se)ond !te *-;3. (ill e)ho a)4 (hen iss0ing the third !te of the Programming
Enale instr0)tion' :hether the e)ho is )orre)t or not+ all fo0r !tes of the instr0)tion m0st e
transmitted' "f the -;3 did not e)ho a)4+ gi/e S<K a $ositi/e $0lse and iss0e a ne( Programming
Enale instr0)tion' "f the -;3 is not seen (ithin 32 attem$ts+ there is no f0n)tional de/i)e
)onne)ted'
6' "f a <hi$ Erase is $erformed *m0st e done to erase the Flash.+ (ait t
:&GERASE
after the
instr0)tion+ gi/e RESET a $ositi/e $0lse+ and start o/er from ste$ 2' See Tale 30 for t:&GERASE
/al0e'
;' The Flash or EEPROM arra! is $rogrammed one !te at a time ! s0$$l!ing the address and data
together (ith the a$$ro$riate :rite instr0)tion' An EEPROM memor! lo)ation is first a0tomati)all!
erased efore ne( data is (ritten' Hse &ata Polling to dete)t (hen the ne9t !te in the Flash or
EEPROM )an e (ritten' "f $olling is not 0sed+ (ait t:&GPRO? efore transmitting the ne9t
instr0)tion' See Tale 31 for t:&GPRO? /al0e' "n an erased de/i)e+ no -FFs in the data file*s. need
to e $rogrammed'
I' An! memor! lo)ation )an e /erified ! 0sing the Read instr0)tion that ret0rns the )ontent at the
sele)ted address at the serial o0t$0t M"SO *P=I. $in'
B' At the end of the $rogramming session+ RESET )an e set high to )ommen)e normal o$eration'
%' Po(er#off seE0en)e *if needed.>
Set 7TA31 to @0A *if a )r!stal is not 0sed.'
Set RESET to @1A'
T0rn 1<< $o(er off'
&ata Polling EEPROM :hen a !te is eing $rogrammed into the EEPROM+ reading the address lo)ation
eing $rogrammed (ill gi/e the /al0e P1 0ntil the a0to#erase is finished+ and then the /al0e P2' See
Tale 2B for P1 and P2 /al0es'
At the time the de/i)e is read! for a ne( EEPROM !te+ the $rogrammed /al0e (ill read )orre)tl!'
This is 0sed to determine (hen the ne9t !te )an e (ritten' This (ill not (or4 for the /al0es P1
and P2+ so (hen $rogramming these /al0es+ the 0ser (ill ha/e to (ait for at least the $res)ried
time t:&GPRO? efore $rogramming the ne9t !te' See Tale 30 for t:&GPRO? /al0e' As a )hi$#erased
de/i)e )ontains -FF in all lo)ations+ $rogramming of addresses that are meant to )ontain -FF )an e
s4i$$ed' This does not a$$l! if the EEPROM is re$rogrammed (itho0t first )hi$#erasing the de/i)e'
Tale 2B' Read =a)4 1al0e d0ring EEPROM Polling
&ata Polling Flash :hen a !te is eing $rogrammed into the Flash+ reading the address lo)ation
eing $rogrammed (ill gi/e the /al0e -BF' At the time the de/i)e is read! for a ne( !te+ the
$rogrammed /al0e (ill read )orre)tl!' This is 0sed to determine (hen the ne9t !te )an e (ritten'
This (ill not (or4 for the /al0e -BF+ so (hen $rogramming this /al0e+ the 0ser (ill ha/e to (ait for
at least t:&GPRO? efore $rogramming the ne9t !te' As a )hi$erased de/i)e )ontains -FF in all
lo)ations+ $rogramming of addresses that are meant to )ontain -FF )an e s4i$$ed'
Fig0re ;6' Serial Programming :a/eforms
3
Tale 2%' Serial Programming "nstr0)tion Set
5ote> a , address high its+ , address lo( its+ D , 0 J 3o( !te+ 1 J Digh =!te+ o , data o0t+ i
, data in+ 9 , dont )are+ 1 , 3o)4 it 1+ 2 , 3o)4 it 2'
5ote> 1' The signat0re !tes are not readale in lo)4 mode 3+ i'e' oth 3o)4 its $rogrammed'
Serial Programming <hara)teristi)s
Fig0re ;;' Serial Programming Timing
Tale 29' Serial Programming <hara)teristi)s+ TA , #60K< to %;K<+ 1<< , 2'B # I'01 *0nless other(ise
noted.
6