memory-prom

Read, verify, and rescue parallel EPROMs, EEPROMs, Flash memories, and other addressable read-only devices. Basic writes and an Atmel sector programming operation are also available; programming algorithms are device dependent.

Wiring and timing

Connect --dq to the data bus, ordered from the least significant bit, and --a to the low address bits in the same order. Connect --oe, --ce, and, for writing, --we to the corresponding active-low control signals. Omitted control signals must be held at the appropriate level externally. Connect the grounds and arrange memory power separately. Select an I/O voltage compatible with the memory and any address shift registers.

For memories with more address lines than available pins, connect the high address bits through a serial-in, parallel-out shift register such as a chain of 74HC164 devices. Specify its clock and serial input with --a-clk and --a-si, and the total address width with --a-bits. High address bits are shifted most significant bit first. For registers with output latches, use --a-lat as well. Without --a-bits, the address width is the number of direct address pins.

Set --read-cycle, --write-cycle, and --write-hold according to the memory datasheet; these values are in nanoseconds. --shift-freq is in MHz.

Reading and programming

For example, read a 64 Kiword, eight-bit memory with an external 16-bit address shift register:

glasgow run memory-prom -V 5 --dq A0:7 --a-clk B0 --a-si B1 \
    --a-bits 16 --oe B2 --ce B3 read -f dump.bin

Addresses and lengths count words, including for buses wider than eight bits. Files store each word in ceil(data_width / 8) bytes, little endian by default; use --endian big for most significant byte first. read wraps around at the memory depth, and defaults to reading the entire memory. To compare a dump against the device, use verify -f dump.bin with the same wiring arguments.

write buffers its complete command sequence before issuing write pulses, so host transfer delays do not interrupt page programming. The escaped command sequence must fit in the 1024-byte command buffer; large writes must be split. It does not poll for programming completion. atmel write --sector-size WORDS splits the input at sector boundaries and polls after each sector. It does not preserve unwritten bytes or issue an unlock sequence. Use it only with a device supporting that algorithm, and choose a power-of-two sector size from its datasheet. This applet does not provide the elevated programming voltage required by many EPROMs.

Assessing data retention

health check compares repeated reads in shuffled address order against an initial read. health scan continues until the requested number of consecutive reads finds no new unstable addresses, optionally recording them with -f. These operations identify inconsistent reads; they cannot prove that stable data is correct.

health sweep reduces the I/O supply voltage from the value selected with -V until its samples agree. Both ports must have the same explicit numeric starting voltage (for example, -V 5). health popcount --sweep START:END results.json records the number of set bits over a voltage range. Both operations change Glasgow's A and B port voltages, so the memory supply must track that voltage for the measurement to reflect its supply dependence. Stay within the ratings of the memory and all connected logic. Display the collected population counts with:

glasgow tool memory-prom popcount results.json

CLI reference

glasgow run memory-prom

Read parallel memories compatible with 27/28/29-series read-only memory, such as Microchip 27C512, Atmel AT28C64B, Atmel AT29C010A, or hundreds of other memories that typically have "27X"/"28X"/"29X" where X is a letter in their part number. This applet can also read any other directly addressable memory, such as a mask ROM or a fully combinatorial GAL/PAL.

Floating gate based memories (27x EPROM, 28x EEPROM, 29x Flash) retain data for decades, but not indefinitely, since the stored charge slowly decays. This applet can identify memories at risk of data loss, estimate the level of decay, and suggest conditions under which the memory may still be read reliably. See health --help for details.

To handle the large amount of address lines used by parallel memories, this applet supports two kinds of addressing: direct and indirect. The full address word (specified with the --a-bits option) is split into low and high parts. The low part is presented directly on the IO pins (specified with the --a option). The high part is presented through a SIPO shift register (clock and data input specified with the --a-clk and --a-si options respectively), such as a chain of 74HC164 ICs of the appropriate length. Additionally, for shift registers with latches, specify --a-lat to drive the latch pins.

usage: glasgow run memory-prom [-h] [-V VOLTS] [--dq PINS] [--a PINS]
                               [--a-clk PIN] [--a-si PIN] [--a-lat PIN]
                               [--oe PIN] [--we PIN] [--ce PIN]
                               [--a-bits COUNT] [--shift-freq FREQ]
                               [--read-cycle DELAY] [--write-cycle DELAY]
                               [--write-hold DELAY]
                               OPERATION ...
-h, --help

show this help message and exit

-V <volts>, --voltage <volts>

set I/O port voltage to VOLTS

--dq <pins>

bind the applet I/O lines 'dq' to PINS (default: 'A0,A1,A2,A3,A4,A5,A6,A7', optional)

--a <pins>

bind the applet I/O lines 'a' to PINS (optional)

--a-clk <pin>

bind the applet I/O line 'a_clk' to PIN (optional)

--a-si <pin>

bind the applet I/O line 'a_si' to PIN (optional)

--a-lat <pin>

bind the applet I/O line 'a_lat' to PIN (optional)

--oe <pin>

bind the applet I/O line 'oe' to PIN (optional)

--we <pin>

bind the applet I/O line 'we' to PIN (optional)

--ce <pin>

bind the applet I/O line 'ce' to PIN (optional)

--a-bits <count>

set total amount of address lines to COUNT (includes direct and indirect lines)

--shift-freq <freq>

set indirect address shift frequency to FREQ MHz (default: 12)

--read-cycle <delay>

set read cycle time to DELAY ns (default: 500)

--write-cycle <delay>

set write cycle time to DELAY ns (default: same as read cycle time)

--write-hold <delay>

set write hold time to DELAY ns (default: 500)

glasgow run memory-prom atmel

usage: glasgow run memory-prom atmel [-h] VENDOR-OPERATION ...
-h, --help

show this help message and exit

glasgow run memory-prom atmel write

usage: glasgow run memory-prom atmel write [-h] -S WORDS -f FILENAME
                                           [-e {little,big}]
                                           [ADDRESS]
address

write memory starting at address ADDRESS

-h, --help

show this help message and exit

-S <words>, --sector-size <words>

perform read-modify-write on WORDS-aligned blocks

-f <filename>, --file <filename>

write contents of FILENAME to memory

-e {little,big}, --endian {little,big}

operate on files with the specified endianness (default: little)

glasgow run memory-prom health

usage: glasgow run memory-prom health [-h] MODE ...
-h, --help

show this help message and exit

glasgow run memory-prom health check

usage: glasgow run memory-prom health check [-h] [--samples COUNT]
-h, --help

show this help message and exit

--samples <count>

read entire memory COUNT times (default: 5)

glasgow run memory-prom health popcount

usage: glasgow run memory-prom health popcount [-h] [--samples COUNT]
                                               --sweep START:END
                                               [--voltage-step STEP]
                                               FILENAME
filename

write aggregated data to FILENAME

-h, --help

show this help message and exit

--samples <count>

average population count COUNT times (default: 5)

--sweep <start:end>

sweep supply voltage from START to END volts

--voltage-step <step>

change supply voltage by STEP volts (default: 0.05)

glasgow run memory-prom health scan

usage: glasgow run memory-prom health scan [-h] [--confirmations COUNT]
                                           [-f FILENAME]
-h, --help

show this help message and exit

--confirmations <count>

read entire memory repeatedly until COUNT consecutive samples detect no new unstable words (default: 10)

-f <filename>, --file <filename>

write hex addresses of unstable cells to FILENAME

glasgow run memory-prom health sweep

usage: glasgow run memory-prom health sweep [-h] [--samples COUNT]
                                            [--voltage-step STEP]
-h, --help

show this help message and exit

--samples <count>

read entire memory COUNT times (default: 5)

--voltage-step <step>

reduce supply voltage by STEP volts (default: 0.05)

glasgow run memory-prom read

usage: glasgow run memory-prom read [-h] [-f FILENAME] [-e {little,big}]
                                    [ADDRESS] [LENGTH]
address

read memory starting at address ADDRESS, with wraparound

length

read LENGTH words from memory

-h, --help

show this help message and exit

-f <filename>, --file <filename>

write memory contents to FILENAME

-e {little,big}, --endian {little,big}

operate on files with the specified endianness (default: little)

glasgow run memory-prom verify

usage: glasgow run memory-prom verify [-h] -f FILENAME [-e {little,big}]
                                      [ADDRESS]
address

verify memory starting at address ADDRESS

-h, --help

show this help message and exit

-f <filename>, --file <filename>

compare memory with contents of FILENAME

-e {little,big}, --endian {little,big}

operate on files with the specified endianness (default: little)

glasgow run memory-prom write

usage: glasgow run memory-prom write [-h] -f FILENAME [-e {little,big}]
                                     [ADDRESS]
address

write memory starting at address ADDRESS

-h, --help

show this help message and exit

-f <filename>, --file <filename>

write contents of FILENAME to memory

-e {little,big}, --endian {little,big}

operate on files with the specified endianness (default: little)

glasgow tool memory-prom

Display statistics collected of parallel memories collected with the health subcommand.

usage: glasgow tool memory-prom [-h] OPERATION ...
-h, --help

show this help message and exit

glasgow tool memory-prom popcount

usage: glasgow tool memory-prom popcount [-h] FILENAME
filename

read aggregated data from FILENAME

-h, --help

show this help message and exit

API reference

In REPL and script mode, prom_iface provides access to the configured memory. Timing parameters in the Python constructor use seconds and hertz.

class glasgow.applet.memory.prom.MemoryPROMInterface(logger: Logger, assembly: AbstractAssembly, *, dq: list[GlasgowPin], a: list[GlasgowPin], a_bits: int, a_clk: GlasgowPin | None = None, a_si: GlasgowPin | None = None, a_lat: GlasgowPin | None = None, oe: GlasgowPin | None = None, we: GlasgowPin | None = None, ce: GlasgowPin | None = None, shift_frequency: float = 12e6, read_cycle: float = 500e-9, write_cycle: float = 500e-9, write_hold: float = 500e-9)

Access a parallel memory using word addresses and little-endian wire data.

Wider-than-eight-bit words occupy consecutive bytes, least significant byte first. Use Data to convert file byte order independently of the wire format.

class Data(raw_data, dq_bytes, endian='little')

Byte-backed sequence of integer words with a selectable file byte order.

async read(address, count)

Read count words starting at address, wrapping at the memory depth.

async read_shuffled(address, count)

Read words in random address order, returning them in linear order.

async write(address, data)

Queue and execute a contiguous write of integer words at address.

The escaped command sequence must fit in the 1024-byte command buffer. This does not wait for the memory to finish internal programming.

async poll()

Wait until the data bus matches the last written word.