Posts Tagged ‘reverse mcu eeprom’

PostHeaderIcon PIC12LC508: LC Is a Voltage Bin, Not a Second Design

Letters after a part number are usually read as features, and the middle letter of PIC12LC508 is not one. It marks a bin: the same die, screened at final test to a wider supply range, with the low end of that range guaranteed rather than merely tolerated. Knowing this changes two things at once, the way the part is read and the confidence that can be placed in what comes out.

Reverse Chip PIC12LC508 Heximal File is a process to replicate cpu pic12lf508 program from memory, and then extract the code from pic12lf508 locked flash memory.

What the letters are doing

The C in the family name indicates the erasable process, and the L indicates the low-voltage screen. A part that passes at two volts is a part whose cells switch with less margin than one that only has to work at five, and the test house knows it: the screen is what separates the two, and the same wafer supplies both. There is no second mask set, no separate array layout, and no difference in word count or instruction set. Anyone treating the LC as a distinct design will over-plan the read.

Same layout, and therefore the same route

Because the die is shared, every route proven on the ordinary part transfers unchanged. The array is 512 by 12, the protection bit sits in the same configuration word, a protected read returns zero across the range, and the factory trim lives in the last word. What transfers is the plan; what does not transfer is the yield. The same etch, the same probe, the same lighting, and a different number of usable reads, because the cells start closer to the decision boundary.

Why a looser part reads differently

A cell is read by comparing its current against a reference. The screen guarantees that the comparison resolves correctly at the low end of the supply range, which means the part is characterised at a point where the difference between a programmed and an erased cell is smaller. That is good in the field and awkward afterwards: the margin a reader works with is the margin the part was screened to.

Retention is where the bin shows

Property Effect of the low-voltage screen Consequence for a read
Cell margin Narrower by design More marginal bits at any age
Supply floor Two volts guaranteed Reads at five volts may differ
Ageing Faster charge loss Repeat reads disagree
Word count Unchanged Plan transfers intact

The third row is the one that costs time. A part stored for twenty years in a warehouse will have lost charge, and a low-voltage bin will show it first. Two reads taken minutes apart can differ in a handful of words, and the honest response is not to pick the reading that looks more like a program but to read a third time and take the majority per bit.

Reading it properly

Supply the part at the voltage the screen specifies, not at the voltage that is convenient. Read at least twice, ideally at both ends of the permitted range, and compare word by word. Words that agree are settled; words that disagree go to a majority vote over more passes, and any word that still disagrees is flagged in the deliverable rather than silently resolved. Then check the result the way any image is checked: it has to disassemble into a program that makes sense, and its length has to match the array exactly.

When the trim value is the real problem

The last word of the array holds the factory trim for the internal oscillator, and on a low-voltage bin that number matters more than on the ordinary part because the spread it has to cover is wider. A recovered image without it will run, and it will run at a frequency that is legal but wrong, which on a design that bit-bangs a serial protocol is a functional failure that looks like a firmware bug. Treat the last word as part of the image, and if it is missing, say so in the deliverable rather than leaving the omission for the customer to discover.

What to tell a customer who asks for the LC version

That it is the same chip, tested at a lower supply, and that this makes the read slightly less certain rather than slightly harder. The plan is unchanged, the price is unchanged, and the caveat is that a marginal word may have to be reported as uncertain. Customers accept that framing because they chose the low-voltage part for a battery.

Where this connects

The plain-voltage sibling is covered in PIC12C508 code, and the trim word it depends on matters more here because a low-voltage bin has a wider spread to begin with. The clocking question that produces shifted reads is in PIC12F508 firmware, and the way a marginal image is turned into a verified file is the subject of extracting MCU code.

PostHeaderIcon Reverse MCU ATmega461PV Binary

Reverse MCU ATmega461PV and readout microcontroller atmega461pv secured Binary, crack mcu protective system and using focus ion beam to cut off the security fuse bit;

Reverse MCU ATmega461PV and readout microcontroller atmega461pv secured Binary, crack mcu protective system and using focus ion beam to cut off the security fuse bit
Reverse MCU ATmega461PV and readout microcontroller atmega461pv secured Binary, crack mcu protective system and using focus ion beam to cut off the security fuse bit

The interconnection between Master and Slave CPUs with SPI is shown in Figure 80. The system consists of two shift Registers, and a Master clock generator. Th e SPI Master initiates the communication cycle when pulling low the Slave Select SS pin of the desired Slave.

Master and Slave prepare the data to be sent in their respective shift Registers, and the Master generates the required clock pulses on the SCK line to interchange data if break atmega64pa MCU binary.

Data is always shifted from Master to Slave on the Master Out – Slave In, MOSI, line, and from Slave to Master on the Master In – Slave Out, MISO, line. After each data packet, the Master will synchronize the Slave by pulling high the Slave Select, SS, line.

When configured as a Master, the SPI interface has no automatic control of the SS line. This must be handled by user software before communication can start. When this is done, writing a byte to the SPI Data Register starts the SPI clock generator, and the hardware shifts the eight bits into the Slave. After shifting one byte, the SPI clock generator stops, setting the end of Transmission Flag (SPIF) after break atmega128a MCU firmware.

If the SPI Interrupt Enable bit (SPIE) in the SPCR Register is set, an interrupt is requested. The Master may continue to shift the next byte by writing it into SPDR, or signal the end of packet by pulling high the Slave Select, SS line. The last incoming byte will be kept in the Buffer Register for later use. When configured as a Slave, the SPI interface will remain sleeping with MISO tri-stated as long as the SS pin is driven high. In this state, software may update the contents of the SPI Data Register, SPDR, bu t the data will not be shifted out by incoming clock pulses on the SCK pin until the SS pin is driven low.

As one byte has been completely shifted, the end of Transmission Flag, SPIF is set. If the SPI Interrupt Enable bit, SPIE, in the SPCR Register is set, an interrupt is requested.

The Slave may continue to place new data to be sent into SPDR before reverseing the incoming data. The last incoming byte will be kept in the Buffer Register for later use. The system is single buffered in the transmit direction and double buffered in the receive direction. This means that bytes to be transmitted cannot be written to the SPI Data Register before the entire shift cycle is completed.

When receiving data, however, a received character must be reverse from the SPI Data Register before the next character has been completely shifted in. Otherwise, the first byte is lost.

In SPI Slave mode, the control logic will sample the incoming signal of the SCK pin. To ensure correct sampling of the clock signal, the frequency of the SPI clock should never exceed fosc/4.

PostHeaderIcon ATmega261: Reading Two Images Against Each Other

One image describes a program. Two images of the same program at different points in its life describe a development process, and that is frequently the more useful artefact.

The technique is simple: align the two files, mark every differing byte, and classify the differences. What emerges is a map of where the design changes — and, just as informative, where it does not.

Why two images beat one

A single image requires the analyst to decide, from nothing, which parts are logic and which are constants. Two images resolve that by observation: regions that never change across versions are likely to be structural, and regions that change with every build are likely to be parameters or version strings.

Three specific questions become answerable:

What changed in the last firmware update? The diff is the changelog, and it is more honest than the release notes.

Which values are per-unit? If two units of the same firmware differ in a small region, that region holds calibration.

Where does the version identifier live? It changes between releases and not between units, which distinguishes it from calibration.

Reading the diff

Aligned byte-wise, a diff of two builds usually shows four kinds of region:

Pattern Interpretation
Large identical block Unchanged code, the bulk of the program
Scattered single-byte changes Constants or immediate values adjusted
Contiguous changed block A function rewritten or added
Short changed string A version or identifier

The third kind is the interesting one, and its length is a measure of the change. A twenty-byte change is a constant; a four-hundred-byte change is a function.

The alignment problem

Two builds of the same source with small changes produce images whose addresses shift, because code size changes propagate. A naive byte-wise diff then reports the entire tail as different, which is useless.

Two practical approaches:

Anchor on the vector table and on identifiable strings. These are stable across builds, and they let you align regions rather than bytes.

Diff at instruction level rather than byte level. Decoding both images and comparing instruction sequences tolerates insertion better, because a decoder resynchronises at the next valid instruction.

Neither is perfect. A function inserted early in the image shifts everything after it, and only instruction-level comparison with explicit resynchronisation handles that reliably.

What per-unit comparison reveals

Two devices running identical firmware differ only where the firmware reads data that is unique to the unit. That is typically EEPROM rather than flash, but not always: some builds store a serial in the flash at production time, written after the main image.

A flash region that differs between two units of the same version is therefore a strong indication of production programming, and the region’s size and structure usually identify what it holds — a few bytes for a serial, a table for calibration.

Limits worth stating

Differential reading assumes the two images are the same product. Two different products built on the same part will differ everywhere and yield nothing.

It also assumes both images were read correctly. A single marginal byte in one file produces a false difference, and a false difference in a structural region invites a wrong conclusion. Verifying each page twice before diffing is not optional.

Finally, the technique describes change, not intent. It says what was edited, not why — and the why is what a reconstruction has to supply.

Practical sequence

  1. Read both devices fully, each page verified twice.
  2. Record signature, fuses, and lock byte for each; discard the comparison if they differ.
  3. Align on the vector table and on strings.
  4. Classify differing regions.
  5. Report both the diff and the unchanged bulk, because the second is what the design kept.

Related notes

FAQ

Does a diff require identical part numbers? Yes, ideally, and at minimum the same signature and fuse settings.

Can a diff work across firmware versions far apart? It degrades as the code diverges. Beyond a point the images share only their framework.

What does an unchanged region prove? That the design kept it. Not that it is correct, only that it was not revised.

Why verify before diffing? Because a single misread byte creates a false difference, and false differences in structural regions mislead.

Conclusion

Two images turn an inference into an observation. Structure, constants and version identifiers separate themselves, and the unchanged bulk describes what the design held constant. The technique’s limits are real — same product, clean reads, aligned on anchors — and within them it is the fastest route to understanding a program’s history.