1<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"><head> 2<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> 3<meta name="ProgId" content="Word.Document"> 4<meta name="Generator" content="Microsoft Word 9"> 5<meta name="Originator" content="Microsoft Word 9"> 6<link rel="File-List" href="http://www.users.globalnet.co.uk/%7Ehjames/ti/EEPROM%20Programming_files/filelist.xml"><title>EEPROM Programming</title><!--[if gte mso 9]><xml> 7 <o:DocumentProperties> 8 <o:Author>Gareth James</o:Author> 9 <o:Revision>1</o:Revision> 10 <o:TotalTime>0</o:TotalTime> 11 <o:Created>2000-04-12T14:13:00Z</o:Created> 12 <o:Pages>1</o:Pages> 13 <o:Words>415</o:Words> 14 <o:Characters>2367</o:Characters> 15 <o:Lines>19</o:Lines> 16 <o:Paragraphs>4</o:Paragraphs> 17 <o:CharactersWithSpaces>2906</o:CharactersWithSpaces> 18 <o:Version>9.2720</o:Version> 19 </o:DocumentProperties> 20 <o:OfficeDocumentSettings> 21 <o:DoNotRelyOnCSS/> 22 </o:OfficeDocumentSettings> 23</xml><![endif]--><!--[if gte mso 9]><xml> 24 <w:WordDocument> 25 <w:View>Normal</w:View> 26 <w:Zoom>0</w:Zoom> 27 <w:DoNotOptimizeForBrowser/> 28 </w:WordDocument> 29</xml><![endif]--> 30 31 32<style> 33<!-- 34 /* Font Definitions */ 35@font-face 36 {font-family:"MS Mincho"; 37 panose-1:0 0 0 0 0 0 0 0 0 0; 38 mso-font-alt:"\FF2D\FF33 \660E\671D"; 39 mso-font-charset:128; 40 mso-generic-font-family:roman; 41 mso-font-format:other; 42 mso-font-pitch:fixed; 43 mso-font-signature:1 134676480 16 0 131072 0;} 44@font-face 45 {font-family:"\@MS Mincho"; 46 panose-1:0 0 0 0 0 0 0 0 0 0; 47 mso-font-charset:128; 48 mso-generic-font-family:roman; 49 mso-font-format:other; 50 mso-font-pitch:fixed; 51 mso-font-signature:1 134676480 16 0 131072 0;} 52 /* Style Definitions */ 53p.MsoNormal, li.MsoNormal, div.MsoNormal 54 {mso-style-parent:""; 55 margin:0cm; 56 margin-bottom:.0001pt; 57 mso-pagination:widow-orphan; 58 font-size:12.0pt; 59 font-family:"Times New Roman"; 60 mso-fareast-font-family:"Times New Roman";} 61h3 62 {mso-style-next:Normal; 63 margin-top:12.0pt; 64 margin-right:0cm; 65 margin-bottom:3.0pt; 66 margin-left:0cm; 67 mso-pagination:widow-orphan; 68 page-break-after:avoid; 69 mso-outline-level:3; 70 font-size:13.0pt; 71 font-family:Arial;} 72a:link, span.MsoHyperlink 73 {color:blue; 74 text-decoration:underline; 75 text-underline:single;} 76a:visited, span.MsoHyperlinkFollowed 77 {color:purple; 78 text-decoration:underline; 79 text-underline:single;} 80p.MsoPlainText, li.MsoPlainText, div.MsoPlainText 81 {margin:0cm; 82 margin-bottom:.0001pt; 83 mso-pagination:widow-orphan; 84 font-size:10.0pt; 85 font-family:"Courier New"; 86 mso-fareast-font-family:"Times New Roman";} 87@page Section1 88 {size:595.3pt 841.9pt; 89 margin:1.0cm 1.0cm 1.0cm 1.0cm; 90 mso-header-margin:35.45pt; 91 mso-footer-margin:35.45pt; 92 mso-paper-source:0;} 93div.Section1 94 {page:Section1;} 95@page Section2 96 {size:595.3pt 841.9pt; 97 margin:72.0pt 90.0pt 72.0pt 90.0pt; 98 mso-header-margin:35.4pt; 99 mso-footer-margin:35.4pt; 100 mso-paper-source:0;} 101div.Section2 102 {page:Section2;} 103--> 104</style></head> 105 106<body lang="EN-GB" link="blue" vlink="purple" style=""> 107 108<div class="Section1"> 109 110<h3><b><font size="4" face="Arial"><span style="font-size: 13pt;">EEPROM Programming<o:p></o:p></span></font></b></h3> 111 112<p class="MsoPlainText"><font size="2" face="Courier New"><span style="font-size: 10pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 113 114<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Writing to Flash EEPROMs is much 115slower than writing to RAM, and requires writing control codes to the address 116space of the chip to perform these operations. Apparently the Flash EEPROM used 117is the "SHARP LH28F160S3-L", which has many features (some may be 118disabled) including writing (multiple) words/bytes, erasing 64kb blocks, and 119locking of blocks.<o:p></o:p></span></font></p> 120 121<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 122 123<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">For more information on this chip 124see Johan Borg's file at <a href="http://d188.ryd.student.liu.se/ftp/calculator/ti89/tech/flashrom.txt"><span style="">http://d188.ryd.student.liu.se/ftp/calculator/ti89/tech/flashrom.txt</span></a>, 125he also has put up the datasheet at <a href="ftp://d188.ryd.student.liu.se/calculator/ti89/tech/f160s3.pdf"><span style="">ftp://d188.ryd.student.liu.se/calculator/ti89/tech/f160s3.pdf</span></a> 126which is worth a look.<o:p></o:p></span></font></p> 127 128<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 129 130<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Fortunately only a subset of this 131chips features are used; writing words and erasing blocks. Write operations 132take 12.95 micro-seconds, read operations 100ns, so you can see why a special 133mode of operation is required.<o:p></o:p></span></font></p> 134 135<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 136 137<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">To program the EEPROM we need to 138enter a special mode by writing certain control codes to the address range. Two 139operations can be performed, erase (64kb) sector, and write a word. In this 140write mode reading from the address range gives the status register of the EEPROM, 141generally the only value that is used is that bit 7 of the read word will be 142set when complete. After the operations are complete Read mode is then set by 143writing another control code.<o:p></o:p></span></font></p> 144 145<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 146 147<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">The drawback of this method is that 148the ROM cannot be read whilst write operations are being performed. Therefore 149the writing code must execute from the RAM. Trap 11 handles all of this on the 150calculator, copying the relevant portions to a buffer then executing them.<o:p></o:p></span></font></p> 151 152<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 153 154<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">The following subset of operations 155is used:<o:p></o:p></span></font></p> 156 157<p class="MsoPlainText"><font size="2" face="Courier New"><span style="font-size: 10pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 158 159<table border="1" cellspacing="0" cellpadding="0" width="100%" style="border: medium none ; width: 100%; border-collapse: collapse;"> 160 <tbody><tr> 161 <td width="9%" valign="top" style="border: 0.5pt solid windowtext; padding: 0cm 5.4pt; width: 9.18%;"> 162 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Code<o:p></o:p></span></font></p> 163 </td> 164 <td width="90%" valign="top" style="border-style: solid solid solid none; border-color: windowtext windowtext windowtext -moz-use-text-color; border-width: 0.5pt 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 90.82%;"> 165 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Function<o:p></o:p></span></font></p> 166 </td> 167 </tr> 168 <tr> 169 <td width="9%" style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 0.5pt 0.5pt; padding: 0cm 5.4pt; width: 9.18%;"> 170 <p class="MsoPlainText" align="right" style="text-align: right;"><font size="2" face="Courier New"><span style="font-size: 10pt;">0x5050<o:p></o:p></span></font></p> 171 </td> 172 <td width="90%" valign="top" style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 90.82%;"> 173 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Clear Status 174 Register<o:p></o:p></span></font></p> 175 </td> 176 </tr> 177 <tr> 178 <td width="9%" style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 0.5pt 0.5pt; padding: 0cm 5.4pt; width: 9.18%;"> 179 <p class="MsoPlainText" align="right" style="text-align: right;"><font size="2" face="Courier New"><span style="font-size: 10pt;">0x1010<o:p></o:p></span></font></p> 180 </td> 181 <td width="90%" valign="top" style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 90.82%;"> 182 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Write Setup 183 (next word will be written)<o:p></o:p></span></font></p> 184 </td> 185 </tr> 186 <tr> 187 <td width="9%" style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 0.5pt 0.5pt; padding: 0cm 5.4pt; width: 9.18%;"> 188 <p class="MsoPlainText" align="right" style="text-align: right;"><font size="2" face="Courier New"><span style="font-size: 10pt;">0x2020<o:p></o:p></span></font></p> 189 </td> 190 <td width="90%" valign="top" style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 90.82%;"> 191 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Erase Setup<o:p></o:p></span></font></p> 192 </td> 193 </tr> 194 <tr> 195 <td width="9%" style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 0.5pt 0.5pt; padding: 0cm 5.4pt; width: 9.18%;"> 196 <p class="MsoPlainText" align="right" style="text-align: right;"><font size="2" face="Courier New"><span style="font-size: 10pt;">0xD0D0<o:p></o:p></span></font></p> 197 </td> 198 <td width="90%" valign="top" style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 90.82%;"> 199 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Erase Conform 200 (address)<o:p></o:p></span></font></p> 201 </td> 202 </tr> 203 <tr> 204 <td width="9%" style="border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; border-width: medium 0.5pt 0.5pt; padding: 0cm 5.4pt; width: 9.18%;"> 205 <p class="MsoPlainText" align="right" style="text-align: right;"><font size="2" face="Courier New"><span style="font-size: 10pt;">0xFFFF<o:p></o:p></span></font></p> 206 </td> 207 <td width="90%" valign="top" style="border-style: none solid solid none; border-color: -moz-use-text-color windowtext windowtext -moz-use-text-color; border-width: medium 0.5pt 0.5pt medium; padding: 0cm 5.4pt; width: 90.82%;"> 208 <p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Read Memory<o:p></o:p></span></font></p> 209 </td> 210 </tr> 211</tbody></table> 212 213<p class="MsoPlainText"><font size="2" face="Courier New"><span style="font-size: 10pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 214 215<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Erasing and writing require to 216writes, e.g. 0x2020, 0xD0D0 to perform erase to prevent accidental operations.<o:p></o:p></span></font></p> 217 218<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 219 220<p class="MsoNormal"><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">Note<o:p></o:p></span></font></b></p> 221 222<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">The flash memory is, by default, 223write protected by the system. And can only be written to under special 224circumstances. See <span style="">Intelligent 225Memory<!--[if gte mso 9]><xml> 226 <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F005200650066003400370038003200320031003400370038000000</w:data> 227</xml><![endif]--></span>.<o:p></o:p></span></font></p> 228 229<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 230 231<p class="MsoNormal"><b><font size="3" face="Times New Roman"><span style="font-size: 12pt; font-weight: bold;">Examples</span></font></b><span style=""><o:p></o:p></span></p> 232 233<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;">;erase 64kb block 234in which ERASE_ADDR resides<o:p></o:p></span></font></p> 235 236<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>lea<span style=""> </span><span style=""> </span>(ERASE_ADDR),a2<o:p></o:p></span></font></p> 237 238<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0x5050,(a2)<span style=""> </span>;Clear Status 239Register<o:p></o:p></span></font></p> 240 241<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0x2020,(a2)<span style=""> </span>;Erase Setup<o:p></o:p></span></font></p> 242 243<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0xD0D0,(a2)<span style=""> </span>;Erase Confirm<o:p></o:p></span></font></p> 244 245<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;">write_state_busy:<o:p></o:p></span></font></p> 246 247<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>(a2),d0<span style=""> </span><span style=""> </span>;Read Status Register<o:p></o:p></span></font></p> 248 249<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>btst<span style=""> </span><span style=""> </span>#7,d0<span style=""> </span><span style=""> </span><span style=""> </span>;1=Ready<o:p></o:p></span></font></p> 250 251<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>beq<span style=""> </span><span style=""> </span>write_state_busy<o:p></o:p></span></font></p> 252 253<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0xFFFF,(a2)<span style=""> </span>;Read<o:p></o:p></span></font></p> 254 255<p class="MsoPlainText"><font size="2" face="Courier New"><span style="font-size: 10pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 256 257<p class="MsoPlainText"><font size="2" face="Courier New"><span style="font-size: 10pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 258 259<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;">;write VALUE to 260WRITE_ADDR<o:p></o:p></span></font></p> 261 262<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>lea<span style=""> </span><span style=""> </span>(WRITE_ADDR),a2<o:p></o:p></span></font></p> 263 264<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0x5050,(a2)<span style=""> </span>;Clear Status 265Register<o:p></o:p></span></font></p> 266 267<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0x1010,(a2)<span style=""> </span>;Write Setup<o:p></o:p></span></font></p> 268 269<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#VALUE,(a2)<span style=""> </span><span style=""> </span>;Erase 270Confirm<o:p></o:p></span></font></p> 271 272<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;">write_state_busy:<o:p></o:p></span></font></p> 273 274<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>(a2),d0<span style=""> </span><span style=""> </span>;Read Status Register<o:p></o:p></span></font></p> 275 276<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>btst<span style=""> </span><span style=""> </span>#7,d0<span style=""> </span><span style=""> </span><span style=""> </span>;1=Ready<o:p></o:p></span></font></p> 277 278<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>beq<span style=""> </span><span style=""> </span>write_state_busy<o:p></o:p></span></font></p> 279 280<p class="MsoPlainText" style="background: rgb(204, 204, 204) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial;"><font size="2" face="Courier New"><span style="font-size: 10pt;"><span style=""> </span>move.w<span style=""> </span>#0xFFFF,(a2)<span style=""> </span>;Read<o:p></o:p></span></font></p> 281 282</div> 283 284<font size="3" face="Times New Roman"><span style="font-size: 12pt; font-family: "Times New Roman";"><br clear="all" style="page-break-before: always;"> 285</span></font> 286 287<div class="Section2"> 288 289<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p></span></font></p> 290 291</div> 292 293</body></html>