1 Introduction
2 ------------
3
4 The ArduinoAm29F010 project provides software and a circuit to program
5 Am29F010 flash memory devices using an Arduino board (tested with the Arduino
6 Duemilanove, but likely to work with the Arduino Uno and directly-related
7 boards). In addition, guidance about the use of such flash memory devices is
8 provided for use with microcomputer systems, such as the Acorn Electron.
9
10 The Am29F010-90PC product has been used to test the software and hardware
11 design described here. The PDIP variant of the device, as opposed to the
12 various other packages employed in the product range, is the variant most
13 suitable for use with the Arduino.
14
15 Contact, Copyright and Licence Information
16 ------------------------------------------
17
18 The author can be contacted at the following e-mail address:
19
20 paul@boddie.org.uk
21
22 Copyright and licence information can be found in the docs directory - see
23 docs/COPYING.txt and docs/gpl-3.0.txt for more information.
24
25
26
27 Using the Software
28 ==================
29
30 First of all, to use the Arduino-based programming solution, the Arduino needs
31 to have a program transferred to it. The program is compiled using the
32 Makefile provided, using the simple command...
33
34 make
35
36 To upload the program, the "upload" target is used as follows:
37
38 make upload
39
40 It is likely that this will fail unless appropriate permissions are available
41 on the device through which the Arduino is accessed on the host machine. Thus,
42 a privileged invocation is likely to be necessary:
43
44 sudo make upload
45
46 Testing the Program
47 -------------------
48
49 With the program uploaded, it should now be possible to communicate with the
50 Arduino. Unless the programming circuit has been constructed, however, there
51 will not be any effect of communicating with the Arduino, other than to check
52 that the program is operational. Running the upload.py script as follows will
53 permit such a test:
54
55 ./upload.py -i
56
57 Again, it is likely that this will need to be run in a privileged fashion as
58 follows:
59
60 sudo ./upload.py -i
61
62 The script should act as a terminal, showing a ">" prompt that can accept
63 various commands. Merely getting the prompt should be enough of an indication
64 that the program is functioning on the device.
65
66 Issuing read commands permits the testing of addresses in the device:
67
68 location sector
69 R00000 0x0000 0 (the first location in the device)
70 R07fff 0x7fff 1 (the final location in sector 1)
71 R10000 0x10000 4 (the first location in sector 4)
72 R1ffff 0x1ffff 7 (the final location in the device)
73
74 Uploading and Testing Images
75 ----------------------------
76
77 Once the programming circuit has been constructed (see "Arduino Interfacing"
78 below), the upload.py script can be used to upload data to the Am29F010
79 device. For example:
80
81 sudo ./upload.py jungle.rom
82
83 This will take jungle.rom and write it to the first sector of the Am29F010. To
84 verify the operation, the following command can be used:
85
86 sudo ./upload.py -v jungle.rom
87
88 To write to other sectors, an option can be specified. For example:
89
90 sudo ./upload.py -s 1 junglecode.rom
91
92 Again, the operation can be verified as follows:
93
94 sudo ./upload.py -s 1 -v junglecode.rom
95
96 Note that the -s option must appear first.
97
98 The upload.py script can accept multiple files and will write each of them to
99 consecutive sectors. However, it can be more prudent to write files
100 individually, especially if the circuit is behaving in a less than completely
101 reliable fashion.
102
103 A Note on Sectors
104 -----------------
105
106 Each sector is 16 kilobytes long, which corresponds to a 14-bit address range
107 (0x0000 to 0x3FFF). The Arduino interface described below supports 17-bit
108 addressing (A0...A16), permitting access to eight sectors (at 0x0000, 0x4000,
109 0x8000, 0xC000, 0x10000, 0x14000, 0x18000 and 0x1C000). The simple mapping from
110 a ROM cartridge to the device leaves A16 grounded and thus unable to access the
111 upper four sectors in the device. However, A16 could be connected to VCC to
112 access the upper four sectors.
113
114
115
116 Making a Printed Circuit Board
117 ==============================
118
119 The pcb directory contains resources for making a PCB with the Fritzing
120 software. In order to track changes in these resources, they have been
121 unpacked from a file saved by Fritzing, and so must be packed together into
122 such a file before being given to Fritzing. This can be done using a script
123 provided:
124
125 ./make_pcb.sh
126
127 This will produce a file called ArduinoAm29F010-arduinouno.fzz containing the
128 resources in a zip archive as Fritzing expects.
129
130 This PCB is featured as a project on the Fritzing Web site:
131
132 http://fritzing.org/projects/arduino-am29f010-programming-shield
133
134
135
136 Device Compatibility
137 ====================
138
139 For use with an Acorn Electron ROM cartridge or other board providing a ROM
140 socket, the compatibility of the Am29F010 needs to be assessed in the context
141 of the ROM sockets likely to be provided.
142
143 Original ROM Pinout Am29F010 Pinout
144 ------------------- ---------------
145
146 1 \/ 32 VCC
147 A16 2 31 WE#
148 1 \/ 28 VCC A15 3 30
149 A12 2 27 A14 A12 4 29 A14
150 A7 3 26 A13 A7 5 28 A13
151 A6 4 25 A8 A6 6 27 A8
152 A5 5 24 A9 A5 7 26 A9
153 A4 6 23 A11 A4 8 25 A11
154 A3 7 22 OE# A3 9 24 OE#
155 A2 8 21 A10 A2 10 23 A10
156 A1 9 20 CS# A1 11 22 CE#
157 A0 10 19 D7 A0 12 21 DQ7
158 D0 11 18 D6 DQ0 13 20 DQ6
159 D1 12 17 D5 DQ1 14 19 DQ5
160 D2 13 16 D4 DQ2 15 18 DQ4
161 GND 14 15 D3 GND/VSS 16 17 DQ3
162
163 Superimposing the Am29F010 onto a ROM socket would provide compatibility for
164 all pins from A12 to GND/VSS and from A14 to D3/DQ3.
165
166 Pin 1 in a ROM socket would correspond to A15 but is not necessarily
167 connected, nor, perhaps, is A14 since only 14 bits are required to address 16
168 kilobytes, although there may be 32 kilobyte sockets connecting A14 and using
169 15 bits to address 32K. A16 and A15 would probably be connected to ground to
170 ensure correct operation, but could also be wired to a selection mechanism so
171 that the entire contents of the flash memory might be exposed.
172
173 Pin 28 is a ROM socket would provide power, but the corresponding pin 30 on an
174 Am29F010 is not connected. Thus pin 30 would need routing to pin 32 for the
175 flash device socket.
176
177 Pin 31 for the Am29F010 would need to be asserted. Thus pin 30 might also be
178 routed to pin 31, so that the device would remain read-only at all times.
179
180 Dual ROM Adapter Usage
181 ======================
182
183 A single Am29F010 device could be wired to two ROM sockets in order to provide
184 data to both. The above wiring guide would be employed, with connections from
185 both sockets being connected to the Am29F010, but additional logic would be
186 required for the CS# signals originating from the sockets in order to expose
187 the appropriate region of flash memory. ROM #1 would be served by a "lower"
188 16K region; ROM #2 would be served by an "upper" 16K region; A14 would be used
189 to switch between these regions.
190
191 When ROM #1's CS# signal is low, an attempt to read from ROM #1 would be
192 occurring, and thus A14 would be held low. And when ROM #2's CS# signal is
193 low, an attempt to read from ROM #2 would be occurring, and thus A14 would be
194 held high.
195
196 Meanwhile, the CS# signal for the two ROM sockets would need to be combined to
197 produce a resultant CE# signal for the Am29F010.
198
199 ROM #1 CS# ROM #2 CS# Am29F010 A14 Am29F010 CE#
200 ---------- ---------- ------------ ------------
201 0 0 Not defined Not defined
202 0 1 0 0
203 1 0 1 0
204 1 1 Not defined 1
205
206 It might therefore be possible to connect A14 to ROM #1's CS# signal. And the
207 resultant CE# signal could be the product of an AND gate:
208
209 Am29F010 CE# = ROM #1 CS# AND ROM #2 CS#
210
211 Wiring Details
212 --------------
213
214 ROM #1 ROM #2 74HC08 Am29F010
215 ------ ------ ------ --------
216 CS# 1A A14
217 CS# 1B
218 1Y CE#
219 OE# OE#
220
221 ROM (Common) 74HC08 Am29F010
222 ------------ ------ --------
223 VCC VCC
224 GND GND
225 VCC VCC
226 VCC WE#
227 D0 DQ0
228 D1 DQ1
229 D2 DQ2
230 D3 DQ3
231 D4 DQ4
232 D5 DQ5
233 D6 DQ6
234 D7 DQ7
235 A0 A0
236 A1 A1
237 A2 A2
238 A3 A3
239 A4 A4
240 A5 A5
241 A6 A6
242 A7 A7
243 A8 A8
244 A9 A9
245 A10 A10
246 A11 A11
247 A12 A12
248 A13 A13
249 GND A15
250 GND A16
251 GND GND
252
253 Note that A15 and A16 are left grounded, effectively exposing only the first
254 two sectors of the device. By connecting either or both of these to VCC, other
255 pairs of sectors can be manually selected. A mechanism could also be devised
256 to allow selection using logic, but this is not explored here.
257
258
259
260 Arduino Interfacing
261 ===================
262
263 Arduino can employ at most 14 digital pins (plus 5 switchable analogue pins),
264 whereas the Am29F010B requires 17 address pins, 8 data pins, plus 3 control
265 pins to be utilised.
266
267 One solution is to map the 3 control pins directly to the Arduino, then to
268 channel address and data via 8 common pins to latches, and then employ two
269 remaining pins to control the latches. When neither latch is selected, the
270 data pins will be used to read or write data from the flash memory.
271
272 In this scheme, A16 must be directly controlled by an additional pin, separate
273 from the latch-based mechanism. As a result, only 14 pins are needed on the
274 Arduino.
275
276 74HC273 Pinout
277 --------------
278
279 MR# 1 \/ 20 VCC
280 Q0 2 19 Q7
281 D0 3 18 D7
282 D1 4 17 D6
283 Q1 5 16 Q6
284 Q2 6 15 Q5
285 D2 7 14 D5
286 D3 8 13 D4
287 Q3 9 12 Q4
288 GND 10 11 CP
289
290 Arduino 74HC273 #1 74HC273 #2 Am29F010
291 ------- ---------- ---------- --------
292 A5 CE#
293 A4 OE#
294 A3 WE#
295 2 CP
296 3 CP
297 4 D3 D3 DQ3
298 5 D2 D2 DQ2
299 6 D1 D1 DQ1
300 7 D0 D0 DQ0
301 8 D4 D4 DQ4
302 9 D5 D5 DQ5
303 10 D6 D6 DQ6
304 11 D7 D7 DQ7
305 Q0 A0
306 Q1 A1
307 Q2 A2
308 Q3 A3
309 Q4 A4
310 Q5 A5
311 Q6 A6
312 Q7 A7
313 Q0 A8
314 Q1 A9
315 Q2 A10
316 Q3 A11
317 Q4 A12
318 Q5 A13
319 Q6 A14
320 Q7 A15
321 A2 A16
322 5V MR# MR#
323 5V VCC VCC VCC
324 GND GND GND VSS
325
326 Set Address
327 -----------
328
329 74HC273 #1 CP = 1; 74HC273 #2 CP = 0
330 74HC273 #1 D[7...0] = A[7...0]
331 74HC273 #1 CP = 0; 74HC273 #2 CP = 1
332 74HC273 #2 D[7...0] = A[15...8]
333 Am29F010 A16 = A[16]
334
335 Write Data
336 ----------
337
338 Configure pins as D[7...0]
339 WE# = 0
340 74HC273 #1 CP = 0; 74HC273 #2 CP = 0
341 74HC273 #3 D[7...0] = D[7...0]
342 WE# = 1
343
344 Read Data
345 ---------
346
347 Configure pins as Q[7...0]
348 OE# = 0
349 74HC273 #1 CP = 1; 74HC273 #2 CP = 0
350 Q[7...0] = 74HC273 #0 Q[7...0]
351 OE# = 1
352
353 Pins
354 ====
355
356 A0-A16 17-bit addressing
357 DQ0-DQ7 8-bit data transfer
358 CE# chip enable
359 OE# output enable
360 WE# write enable
361 VCC 5V
362 VSS ground
363 NC (not connected)
364
365
366
367 Technical Notes
368 ===============
369
370 Low-Level Operations
371 --------------------
372
373 CE# high standby
374 CE# low read, write or output disable
375
376 OE# high, WE# high output disable
377 OE# low, WE# high read
378 OE# high, WE# low write
379
380 Thus, for reading and writing:
381
382 OE# = not WE#
383
384 Timing
385 ------
386
387 According to the datasheet, addresses are latched on the falling edge of the
388 latest of WE# and CE#, data is latched on the rising edge of the latest of WE#
389 and CE#.
390
391 Strategy:
392
393 1. Start with CE#, OE#, WE# high (standby, output disable)
394 2. Bring CE# low (output disable)
395 3. Set addresses
396 4. Bring WE# or OE# low for operation (write or read)
397 5. Read or write data
398 6. Bring WE# or OE# high (output disable)
399
400 Operation Modes
401 ---------------
402
403 By default, the device is in read mode, meaning that merely bringing OE# low
404 will produce data for the asserted address.
405
406 To issue commands to change the mode involves write operations with specific
407 address and data arguments.
408
409 Sectors
410 --------
411
412 A[16...14] selects each 16KB sector and is referred to as the sector address
413 or SA in the documentation.
414
415 Commands
416 --------
417
418 Reset (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$F0)
419
420 Autoselect (manufacturer) (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$90);
421 (A=$X00; read)
422 => D=$01
423
424 Autoselect (device) (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$90);
425 (A=$X01; read)
426 => D=$20
427
428 Simple reset (A=$XXXX; D=$F0)
429
430 Sector erase (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$80);
431 (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=SA; D=$30)
432
433 Program (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$A0);
434 (A=PA; D=PD)
435
436 Progress
437 --------
438
439 Programming and erasure commands employ data pins as follows:
440
441 Programming Erasure
442 DQ7 On completion: DQ7-out On completion: 1
443 DQ6 During: toggling value During: toggling value
444 DQ5 On failure: 1 On failure: 1
445 DQ3 Sector erase begun: 1
446
447 A read operation is required to obtain these outputs, typically with the same
448 address used to initiate each operation.