ArduinoAm29F010

README.txt

25:d6482c4f3bb2
2015-03-09 Paul Boddie Added software notes, Dual ROM Adaptor wiring details, and moved the Arduino interfacing details above the general technical notes.
     1 The Am29F010-90PC product has been used to test the software and hardware
     2 design described here.
     3 
     4 Using the Software
     5 ==================
     6 
     7 First of all, to use the Arduino-based programming solution, the Arduino needs
     8 to have a program transferred to it. The program is compiled using the
     9 Makefile provided, using the simple command...
    10 
    11 make
    12 
    13 To upload the program, the "upload" target is used as follows:
    14 
    15 make upload
    16 
    17 It is likely that this will fail unless appropriate permissions are available
    18 on the device through which the Arduino is accessed on the host machine. Thus,
    19 a privileged invocation is likely to be necessary:
    20 
    21 sudo make upload
    22 
    23 With the program uploaded, it should now be possible to communicate with the
    24 Arduino. Unless the programming circuit has been constructed, however, there
    25 will not be any effect of communicating with the Arduino, other than to check
    26 that the program is operational. Running the upload.py script as follows will
    27 permit such a test:
    28 
    29 ./upload.py -i
    30 
    31 Again, it is likely that this will need to be run in a privileged fashion as
    32 follows:
    33 
    34 sudo ./upload.py -i
    35 
    36 The script should act as a terminal, showing a ">" prompt that can accept
    37 various commands. Merely getting the prompt should be enough of an indication
    38 that the program is functioning on the device.
    39 
    40 Once the programming circuit has been constructed (see "Arduino Interfacing"
    41 below), the upload.py script can be used to upload data to the Am29F010
    42 device. For example:
    43 
    44 sudo ./upload.py jungle.rom
    45 
    46 This will take jungle.rom and write it to the first sector of the Am29F010. To
    47 verify the operation, the following command can be used:
    48 
    49 sudo ./upload.py -v jungle.rom
    50 
    51 To write to other sectors, an option can be specified. For example:
    52 
    53 sudo ./upload.py -s 1 junglecode.rom
    54 
    55 Again, the operation can be verified as follows:
    56 
    57 sudo ./upload.py -s 1 -v junglecode.rom
    58 
    59 Note that the -s option must appear first.
    60 
    61 The upload.py script can accept multiple files and will write each of them to
    62 consecutive sectors. However, it can be more prudent to write files
    63 individually, especially if the circuit is behaving in a less than completely
    64 reliable fashion.
    65 
    66 Device Compatibility
    67 ====================
    68 
    69 For use with an Acorn Electron ROM cartridge or other board providing a ROM
    70 socket, the compatibility of the Am29F010 needs to be assessed in the context
    71 of the ROM sockets likely to be provided.
    72 
    73 Original ROM Pinout     Am29F010 Pinout
    74 -------------------     ---------------
    75 
    76                              1  \/  32 VCC
    77                         A16  2      31 WE#
    78      1  \/  28 VCC      A15  3      30
    79 A12  2      27 A14      A12  4      29 A14
    80 A7   3      26 A13      A7   5      28 A13
    81 A6   4      25 A8       A6   6      27 A8
    82 A5   5      24 A9       A5   7      26 A9
    83 A4   6      23 A11      A4   8      25 A11
    84 A3   7      22 OE#      A3   9      24 OE#
    85 A2   8      21 A10      A2  10      23 A10
    86 A1   9      20 CS#      A1  11      22 CE#
    87 A0  10      19 D7       A0  12      21 DQ7
    88 D0  11      18 D6       DQ0 13      20 DQ6
    89 D1  12      17 D5       DQ1 14      19 DQ5
    90 D2  13      16 D4       DQ2 15      18 DQ4
    91 GND 14      15 D3   GND/VSS 16      17 DQ3
    92 
    93 Superimposing the Am29F010 onto a ROM socket would provide compatibility for
    94 all pins from A12 to GND/VSS and from A14 to D3/DQ3.
    95 
    96 Pin 1 in a ROM socket would correspond to A15 but is not necessarily
    97 connected, nor, perhaps, is A14 since only 14 bits are required to address 16
    98 kilobytes, although there may be 32 kilobyte sockets connecting A14 and using
    99 15 bits to address 32K. A16 and A15 would probably be connected to ground to
   100 ensure correct operation, but could also be wired to a selection mechanism so
   101 that the entire contents of the flash memory might be exposed.
   102 
   103 Pin 28 is a ROM socket would provide power, but the corresponding pin 30 on an
   104 Am29F010 is not connected. Thus pin 30 would need routing to pin 32 for the
   105 flash device socket.
   106 
   107 Pin 31 for the Am29F010 would need to be asserted. Thus pin 30 might also be
   108 routed to pin 31, so that the device would remain read-only at all times.
   109 
   110 Dual ROM Adapter Usage
   111 ======================
   112 
   113 A single Am29F010 device could be wired to two ROM sockets in order to provide
   114 data to both. The above wiring guide would be employed, with connections from
   115 both sockets being connected to the Am29F010, but additional logic would be
   116 required for the CS# signals originating from the sockets in order to expose
   117 the appropriate region of flash memory. ROM #1 would be served by a "lower"
   118 16K region; ROM #2 would be served by an "upper" 16K region; A14 would be used
   119 to switch between these regions.
   120 
   121 When ROM #1's CS# signal is low, an attempt to read from ROM #1 would be
   122 occurring, and thus A14 would be held low. And when ROM #2's CS# signal is
   123 low, an attempt to read from ROM #2 would be occurring, and thus A14 would be
   124 held high.
   125 
   126 Meanwhile, the CS# signal for the two ROM sockets would need to be combined to
   127 produce a resultant CE# signal for the Am29F010.
   128 
   129 ROM #1 CS#  ROM #2 CS#  Am29F010 A14    Am29F010 CE#
   130 ----------  ----------  ------------    ------------
   131 0           0           Not defined     Not defined
   132 0           1           0               0
   133 1           0           1               0
   134 1           1           Not defined     1
   135 
   136 It might therefore be possible to connect A14 to ROM #1's CS# signal. And the
   137 resultant CE# signal could be the product of an AND gate:
   138 
   139 Am29F010 CE# = ROM #1 CS# AND ROM #2 CS#
   140 
   141 Wiring Details
   142 --------------
   143 
   144 ROM #1  ROM #2  74HC08  Am29F010
   145 ------  ------  ------  --------
   146 CS#             1A      A14
   147         CS#     1B
   148                 1Y      CE#
   149 OE#                     OE#
   150 
   151 ROM (Common)    74HC08  Am29F010
   152 ------------    ------  --------
   153 VCC             VCC
   154 GND             GND
   155 VCC                     VCC
   156 VCC                     WE#
   157 D0                      DQ0
   158 D1                      DQ1
   159 D2                      DQ2
   160 D3                      DQ3
   161 D4                      DQ4
   162 D5                      DQ5
   163 D6                      DQ6
   164 D7                      DQ7
   165 A0                      A0
   166 A1                      A1
   167 A2                      A2
   168 A3                      A3
   169 A4                      A4
   170 A5                      A5
   171 A6                      A6
   172 A7                      A7
   173 A8                      A8
   174 A9                      A9
   175 A10                     A10
   176 A11                     A11
   177 A12                     A12
   178 A13                     A13
   179 GND                     A15
   180 GND                     A16
   181 GND                     GND
   182 
   183 Arduino Interfacing
   184 ===================
   185 
   186 Arduino can employ at most 14 digital pins, whereas the Am29F010B requires 17
   187 address pins, 8 data pins, plus 3 control pins to be utilised.
   188 
   189 One solution is to map the 3 control pins directly to the Arduino, then to
   190 channel address and data via 8 common pins to latches, and then employ the
   191 remaining pins to control the latches.
   192 
   193 Two pins can be used to select the latches, and when neither latch is
   194 selected, the data pins will be used to read or write data from the flash
   195 memory.
   196 
   197 As a result, only 13 pins are needed on the Arduino.
   198 
   199 74HC273 Pinout
   200 --------------
   201 
   202 MR#  1  \/  20 VCC
   203 Q0   2      19 Q7
   204 D0   3      18 D7
   205 D1   4      17 D6
   206 Q1   5      16 Q6
   207 Q2   6      15 Q5
   208 D2   7      14 D5
   209 D3   8      13 D4
   210 Q3   9      12 Q4
   211 GND 10      11 CP
   212 
   213 Arduino     74HC273 #1  74HC273 #2  Am29F010
   214 -------     ----------  ----------  --------
   215 A5                                  CE#
   216 A4                                  OE#
   217 A3                                  WE#
   218 2           CP
   219 3                       CP
   220 4           D0          D0          DQ0
   221 5           D1          D1          DQ1
   222 6           D2          D2          DQ2
   223 7           D3          D3          DQ3
   224 8           D4          D4          DQ4
   225 9           D5          D5          DQ5
   226 10          D6          D6          DQ6
   227 11          D7          D7          DQ7
   228             Q0                      A0
   229             Q1                      A1
   230             Q2                      A2
   231             Q3                      A3
   232             Q4                      A4
   233             Q5                      A5
   234             Q6                      A6
   235             Q7                      A7
   236                         Q0          A8
   237                         Q1          A9
   238                         Q2          A10
   239                         Q3          A11
   240                         Q4          A12
   241                         Q5          A13
   242                         Q6          A14
   243                         Q7          A15
   244 GND                                 A16 (not used)
   245 5V          MR#         MR#
   246 5V          VCC         VCC         VCC
   247 GND         GND         GND         VSS
   248 
   249 Set Address
   250 -----------
   251 
   252 74HC273 #1 CP = 1; 74HC273 #2 CP = 0
   253 74HC273 #1 D[7...0] = A[7...0]
   254 74HC273 #1 CP = 0; 74HC273 #2 CP = 1
   255 74HC273 #2 D[7...0] = A[15...8]
   256 
   257 Write Data
   258 ----------
   259 
   260 Configure pins as D[7...0]
   261 WE# = 0
   262 74HC273 #1 CP = 0; 74HC273 #2 CP = 0
   263 74HC273 #3 D[7...0] = D[7...0]
   264 WE# = 1
   265 
   266 Read Data
   267 ---------
   268 
   269 Configure pins as Q[7...0]
   270 OE# = 0
   271 74HC273 #1 CP = 1; 74HC273 #2 CP = 0
   272 Q[7...0] = 74HC273 #0 Q[7...0]
   273 OE# = 1
   274 
   275 Pins
   276 ====
   277 
   278 A0-A16      17-bit addressing
   279 DQ0-DQ7     8-bit data transfer
   280 CE#         chip enable
   281 OE#         output enable
   282 WE#         write enable
   283 VCC         5V
   284 VSS         ground
   285 NC          (not connected)
   286 
   287 Low-Level Operations
   288 ====================
   289 
   290 CE# high            standby
   291 CE# low             read, write or output disable
   292 
   293 OE# high, WE# high  output disable
   294 OE# low, WE# high   read
   295 OE# high, WE# low   write
   296 
   297 Thus, for reading and writing:
   298 
   299 OE# = not WE#
   300 
   301 Timing
   302 ======
   303 
   304 According to the datasheet, addresses are latched on the falling edge of the
   305 latest of WE# and CE#, data is latched on the rising edge of the latest of WE#
   306 and CE#.
   307 
   308 Strategy:
   309 
   310  1. Start with CE#, OE#, WE# high       (standby, output disable)
   311  2. Bring CE# low                       (output disable)
   312  3. Set addresses
   313  4. Bring WE# or OE# low for operation  (write or read)
   314  5. Read or write data
   315  6. Bring WE# or OE# high               (output disable)
   316 
   317 Operation Modes
   318 ===============
   319 
   320 By default, the device is in read mode, meaning that merely bringing OE# low
   321 will produce data for the asserted address.
   322 
   323 To issue commands to change the mode involves write operations with specific
   324 address and data arguments.
   325 
   326 Sectors
   327 =======
   328 
   329 A[16...14] selects each 16KB sector and is referred to as the sector address
   330 or SA in the documentation.
   331 
   332 Commands
   333 ========
   334 
   335 Reset                       (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$F0)
   336 
   337 Autoselect (manufacturer)   (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$90);
   338                             (A=$X00; read)
   339                             => D=$01
   340 
   341 Autoselect (device)         (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$90);
   342                             (A=$X01; read)
   343                             => D=$20
   344 
   345 Simple reset                (A=$XXXX; D=$F0)
   346 
   347 Sector erase                (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$80);
   348                             (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=SA; D=$30)
   349 
   350 Program                     (A=$5555; D=$AA); (A=$2AAA; D=$55); (A=$5555; D=$A0);
   351                             (A=PA; D=PD)
   352 
   353 Progress
   354 --------
   355 
   356 Programming and erasure commands employ data pins as follows:
   357 
   358         Programming                         Erasure
   359 DQ7     On completion: DQ7-out              On completion: 1
   360 DQ6     During: toggling value              During: toggling value
   361 DQ5     On failure: 1                       On failure: 1
   362 DQ3                                         Sector erase begun: 1
   363 
   364 A read operation is required to obtain these outputs, typically with the same
   365 address used to initiate each operation.