Posts Tagged ‘cypress ic program read’

PostHeaderIcon Read Reliability: Three Passes, Slower Clocks, Self-Destruct on Read

Reading a memory produces a file. Producing a file is not the same as obtaining the contents, and the difference is a reliability plan that most extractions do not have.

A dump taken once is a single measurement of a system with marginal cells, marginal timing and an interface with its own error rate. The practices that make it trustworthy are cheap and they are omitted more often than not.

Why a single read is not a measurement

Every read has an error rate, and the error rate depends on the margin at the moment of reading. A cell whose threshold has drifted is read correctly if the sense amplifier’s reference happens to fall on the right side, and incorrectly if it does not. The reference moves with temperature and supply; the cell’s threshold moves with age and with the number of times it has been read.

The consequence is that two reads of the same device can differ, and neither is obviously wrong. A dump that has never been repeated has no way to distinguish a correct byte from a marginal one.

Source of error Effect Detectable by
Marginal cell Isolated bit errors Repeat read
Timing violation Block-level corruption Reducing the rate
Interface noise Random byte errors Repeat read
Address error A block duplicated or skipped Structural check
Partial erase A region reading as erased Comparison with a reference

The fourth row is the one that produces a plausible wrong dump. An address that is off by one block produces an image with a duplicate region and a missing one, and the image looks complete because the total length is correct.

Practice one: three passes

Reading three times and taking a majority vote on each byte is the standard practice, and it is standard because it works.

Two passes detect a disagreement but cannot resolve it. Three passes resolve any single-bit disagreement by majority, and they detect the pattern of a region that is unstable rather than marginally wrong.

Passes Detects disagreement Resolves it Cost
One No No 1×
Two Yes No 2×
Three Yes Yes, for single-bit 3×
Five Yes Yes, for double-bit 5×

The fourth row is used when the device is known to be marginal. On a device with charge loss, five passes and a majority is the difference between an image with a handful of uncertain bytes and an image that is wrong in a way nobody notices.

The output of the practice is not just the image but the disagreement map: the addresses where the passes differed. That map is the most valuable part, because it identifies the cells that are close to the decision threshold and therefore the bytes that cannot be trusted.

Practice two: reduce the rate

Most read errors at speed come from timing rather than from the cells.

The device’s read path has a maximum rate set by its own access time, and the interface has a maximum rate set by the link. Operating at the link’s maximum is fine when the device’s access time has margin, and it is not fine on a device whose access time has drifted with age.

Rate Effect on margin Effect on time
Maximum Minimum margin Fastest
Half Comfortable Twice
Quarter Large Four times
Very slow Very large Impractical for large arrays

The second row is usually enough and costs little. The test that establishes whether it is needed is a comparison of a fast read against a slow read: if they differ, the fast read was marginal.

Practice three: check the structure

An image can be internally consistent and wrong. The structural checks catch the errors that a byte comparison does not.

The vector table is the first. On a processor image it should be at the base, it should contain addresses that land inside the image, and the stack pointer should point inside the RAM range. An image that fails any of those is mis-based, shifted or damaged.

Check Catches
Vector table at the base Wrong base address
Vector entries inside the image Shifted reads
Entry points aligned Corrupted vector table
A known signature or string Wrong region read
Entropy by region A block that is uniformly erased

The fifth row is the one that identifies a partial erase or a block that failed to read. A region of uniform bytes in an image that should contain code is either erased or not actually read, and the two are distinguishable by whether the read command returned an error.

The destructive behaviour

One device behaviour has to be checked before the first read rather than after.

Some parts respond to an unauthorised read by destroying their contents. The mechanism is a protection feature: a read attempt that the device considers illegitimate triggers an erase of a protected region, or of the whole array.

Behaviour Trigger Detectable before
Erase on unauthorised read A read command without a prior authorisation Datasheet, sometimes
Lock-out after N attempts Repeated reads Behaviour on a sacrificial unit
Key destruction A debug session Documentation, rarely
Nothing — Most devices

The first row is documented on parts sold with a security claim and undocumented on parts where the feature is an afterthought. The only reliable test is a sacrificial unit: perform the read that is planned, and see whether the device still works.

The second row is the one that turns a reliability problem into a permanent one. A device that locks out after a small number of reads is a device where a three-pass practice is not available, and the image has to be obtained on the first attempt with the best possible margin.

The read plan

The four practices combine into a plan that is written before the device is touched.

Step Action Purpose
One Establish whether reads are destructive Protect the only unit
Two Read slowly once Maximum margin
Three Read at the intended rate Compare against the slow read
Four Repeat to three passes Majority and disagreement map
Five Apply structural checks Catch what comparison cannot

The third step is the one that is usually skipped and it is the one that produces the most information. A fast read that differs from a slow read has told you that the device is marginal and that the campaign should continue slowly; a fast read that matches has told you that the margin is adequate and the schedule can be kept.

What the deliverable contains

The image, the disagreement map, the structural check results, and a statement of the error rate observed.

Item Content
Image Majority-voted result
Disagreement map Addresses where passes differed
Structural report Which checks passed
Error rate Disagreements per gigabyte
Confidence statement Which regions are certain

The fifth item is the one that lets the customer use the image responsibly. A region with no disagreements across five passes is as certain as the technology allows; a region with repeated disagreements is not, and the difference should be visible in the deliverable rather than buried in a note.

The confidence labelling that extends this idea to a damaged device is in restoring MCU code, and the physical read that is used when the electrical route is unavailable is in extracting IC flash. The channel selection that determines which read command is even available is in read MCU code. Where the objective is to change behaviour rather than preserve it, the sequence of operations is a different one, and it is described in hacking IC program.