Break Mixed Signal MSP430G2744 Flash Memory
Break Mixed Signal MSP430G2744 Flash Memory and write the flash memory program to new msp430g2744 microcontroller for cloning;
The Texas Instruments MSP430™ family of ultra-low-power microcontrollers consists of several devices featuring different sets of peripherals targeted for various applications. The architecture, combined with five low-power modes, is optimized to achieve extended battery life in portable measurement applications.

розбити змішаний сигнал MSP430G2744 флеш-пам’ять і записати програму флеш-пам’яті на новий мікроконтролер MSP430G2744 для клонування;
The device features a powerful 16-bit RISC CPU, 16-bit registers, and constant generators that contribute to maximum code efficiency. The digitally controlled oscillator (DCO) allows the device to wake up from low-power modes to active mode in less than 1 µs.

Flash bellek MSP430G2744 karışık sinyali kırın ve klonlama için yeni MSP430G2744 mikrodenetleyiciye flash bellek programını yazın;
The MSP430G2x44 series is an ultra-low-power mixed-signal microcontroller with two built-in 16-bit timers, a universal serial communication interface (USCI), 10-bit analog-to-digital converter (ADC) with integrated reference and data transfer controller (DTC), and 32 I/O pins which are critical features for locked microcontroller msp430g2452 flash memory breaking.
PIC18F24K40: Memory Execution Prevention Is a Different Kind of Limit
Protection bits are usually about who may look. The K40 generation introduces a control that is about where things may happen: a configuration that prevents the core from fetching instructions out of regions that should only ever hold data.
This is not confidentiality and it does not stop a read. It is a structural constraint, and it matters to anyone rebuilding firmware because a rebuilt image that puts code where the original did not will not run — and the failure will look like a corrupted program rather than a configuration mismatch.
What the control does
With the control enabled, execution is confined to the regions the device considers executable. An attempt to fetch an instruction from a non-executable region produces a reset rather than a wild branch.
The practical benefit to a vendor is robustness: a stack overflow or a corrupted function pointer cannot turn into arbitrary code execution from a buffer. The practical cost to a reader is that the memory map acquires a meaning it did not have before — some regions hold code, others must not.
| Region | Executable when enabled | Typical contents |
|---|---|---|
| Program array, normal range | Yes | Application code |
| Boot block | Yes | Bootloader, vectors |
| Data EEPROM | No | Settings, calibration |
| Stack and heap in RAM | No | Runtime data |
| Configuration area | No | Device settings |
Why this changes a rebuild
A rebuild written from behaviour will naturally place code wherever the compiler puts it, and a compiler targeting this device places code in the executable range. So far, no problem.
The problem appears when a rebuild needs to place a routine outside the normal range — a small loader in the boot block, or a routine that must run from a specific address. If the original did that and the rebuild does not, the behaviour differs; if the rebuild does it and the device has prevention enabled, the device resets.
Diagnosing that from a reset is hard, because a reset looks like a watchdog, a brown-out, or a crash. The distinguishing evidence is that the reset occurs immediately after a call into the affected region, reproducibly, with no other symptom.
Vectors and the relocated table
This generation also allows the interrupt vector table to be relocated, which interacts with execution prevention: the table must live in an executable region, and moving it changes the addresses the hardware fetches from.
For analysis, a relocated vector table is a trap. A reader who assumes the table is at its default address will find data there, decode it as branches, and produce a nonsensical call graph. The tell is that the addresses found do not correspond to plausible code entry points.
Finding the real table requires knowing the configuration, which brings the analysis back to the configuration read — the same first step as on every part discussed here.
What protection still does
None of the above replaces the ordinary protection bits, which remain present and independent:
- code protection, per block, gating reads;
- write protection, per block, gating modification;
- boot block protection, gating both for the small region at the bottom.
Execution prevention is a fourth, orthogonal setting. A device can have execution prevention enabled and no read protection at all — a configuration that is entirely readable and still refuses to run code from a buffer.
Reading a K40 device
The array behaves like the earlier families: block-granular read protection, configuration readable through the programmer, data EEPROM separately protected.
Two differences are worth expecting. The configuration space is larger, with more fields, so a tool’s abbreviated display may hide the field you need. And the device identification area carries more information than on earlier parts, including a unique identifier — useful for distinguishing units but not for recovering code.
Limits and honest expectations
- Execution prevention does not impede reading. It is not a confidentiality feature.
- A rebuild must respect the original’s region assignment, and finding that assignment requires the configuration.
- The failure mode of getting it wrong is a reset, which is easily mistaken for a hardware fault.
Related reading
- PIC18F26K40 and the same core at 64K — the larger sibling, where the vector relocation matters more.
- PIC18F24K22 and the previous generation — what the K22 family does without this control.
- PIC18F23K22 and the difference between read and write protection — the gates that remain unchanged.
FAQ
Does execution prevention stop a read? No. It constrains where the core may fetch instructions from.
What happens if code runs from a non-executable region? The device resets. There is no fault handler for it in the usual sense.
Can it be disabled? It is a configuration setting, changeable by rewriting configuration — which requires an erase.
Does it affect the boot block? The boot block is executable; the setting constrains regions that are not intended to hold code.
Why does a rebuild reset immediately on this part? Usually because it placed a routine where the original did not, and prevention rejected the fetch.
Conclusion
The K40 generation adds a constraint on structure rather than on secrecy: code may only execute where code is allowed. That changes what a rebuilt image must satisfy, and it introduces a failure mode — an immediate, reproducible reset — that looks like hardware and is actually configuration. Reading the configuration first resolves it, as it does on every part in this family.
PIC18F85K22: When the Array Is Not the Only Memory in the Design
Forty pins on the smaller members, eighty here, and with the extra pins comes a parallel memory interface. A design that uses it places data — sometimes code — outside the package, and everything said on this site about “the image” becomes conditional.
The array still holds the program that drives the interface. It does not necessarily hold what the program works on, and it may not hold all of the program.
What the interface changes
Three consequences, in order of importance:
| Consequence | Effect on recovery |
|---|---|
| Data may be external | The image describes the algorithm, not its inputs |
| Code may be external | The image may be incomplete as a program |
| Timing depends on wait states | Behaviour reflects bus configuration, not only flash |
The second is rare on a PIC18 design and happens; the first is common wherever a large table is needed. A lookup table of a few tens of kilobytes is cheaper in an external device than in an 80-pin microcontroller’s flash.
Recognising the arrangement
Four indicators, all obtainable without reading the array:
Pin activity on the upper ports. Address and data lines toggling in bursts, synchronous with execution or with a periodic task.
Configuration of the interface registers. Written early in start-up; their presence in a readable portion of the image is conclusive.
Waiting states in the timing. Execution that slows in proportion to bus configuration rather than to flash access.
Memory size beyond the die. A data structure that cannot fit in the internal RAM and is not in the flash image must be somewhere.
The fourth is the inference that resolves most cases. A design processing a table larger than the array can hold is either computing values or reading them from outside.
What an external table costs in analysis
A table on the bus is not in the image, and its contents may be the most product-specific part of the design. A calibration curve, a characterisation map, a protocol translation table — these often encode the engineering effort that the firmware merely applies.
Recovering them requires either reading the external device directly, which is usually trivial since it is an ordinary memory on an accessible bus, or capturing the bus while the device operates.
The first is preferable and is often overlooked. An external serial flash or EEPROM on a board is readable with a clip and a programmer in minutes; there is no protection on it, because the protection was applied to the microcontroller.
When the design executes from the bus
Executing from external memory is unusual on this family but not unheard of, typically in designs that outgrew the array late in development.
Where it happens, three things follow:
- The image from the array is a loader plus part of the application.
- The bus carries instructions, so a capture reveals them.
- Wait states dominate timing, so behaviour measured on a bench reflects the bus rather than the flash.
The third is a diagnostic. A device whose execution speed changes when the external device is removed is executing from it.
Recovering content from this arrangement
- Read the configuration and the array.
- Determine whether the interface is configured; if not, the design is self-contained.
- If it is, identify the external device from the board and read it directly.
- If it cannot be read directly, capture the bus during operation.
- Reconcile: the array’s code refers to external addresses, and the external content refers back.
Step five is where the two halves become one description. A table read at an address that appears in the disassembly is confirmed as that table by the reference; the pair is far stronger evidence than either alone.
What the array still tells you best
The array holds the decisions: when to read, how to interpret, what to do with the result. The external memory holds the data those decisions operate on. Analysis of behaviour needs both, and the array is the half that explains the other.
That is the reason to recover the array even when the external content is easy to obtain. Content without the code is a list of numbers; the code without the content is an algorithm with missing constants.
Related reading
- PIC18F67K22 and 128K of internal memory — the largest internal-only arrangement.
- PIC18F66K22 and reading the protection pattern — what gates the array itself.
- TMS320F2812 and the same problem on a DSP — external memory as a security boundary, on different silicon.
FAQ
Does the interface mean the program is incomplete? Only if code executes from the bus. Data being external is far more common.
Can the external device be read? Usually directly — it is an ordinary memory with no protection, because the protection was applied elsewhere.
How do I detect the interface in use? Pin activity on the upper ports, interface registers written at start-up, and wait-state-dependent timing.
Is the array still worth recovering? Yes. It holds the interpretation of the external content, which is what makes the content meaningful.
What if the external device is damaged? The code still describes what it expected: address ranges, strides, value ranges. That is enough to reconstruct a functional equivalent.
Conclusion
An external memory interface makes the array one source among several, and the recovery question becomes which source holds the part that matters. On most designs the array holds the interpretation and the bus holds the data — and the cheapest first move is reading the external device, which usually has no protection at all.
MSP430G2452: Seven Things a Locked Device Still Tells You
Protection is usually described as if it made a device opaque. It does not. It closes one channel, the one that reads the array, and leaves everything else in place. A locked device continues to execute, continues to drive its pins, continues to consume power in a pattern determined by its code, and continues to talk on whatever bus the product uses.
The practical question is therefore not how to open the array but what the array was needed for. On a great many projects the answer is one of the seven things below, and several of them do not require the array at all.
The channels, and what each yields
| Channel | What it gives | Cost |
|---|---|---|
| Supply current over time | Loop structure, sleep duty cycle, activity periods | Minutes |
| Pin behaviour at power-up | Initialisation order, which peripherals are enabled | Hours |
| Bus traffic | Protocol, message timing, data layout | Hours |
| The device’s own interfaces | Whatever the program is willing to export | Variable |
| The bootstrap loader | A full image, if the password can be derived | Variable |
| Other devices on the board | Parameters, calibration, identity | Hours |
| Physical access | The array itself | Weeks |
Current as a program trace
The instantaneous supply current of a running microcontroller is a function of what it is doing. Executing code draws one current, sleeping draws another, driving an output draws a third, and switching a radio or an LED produces a distinct step.
Recording that current over seconds or minutes produces a timeline of the program’s behaviour. On a low-power product the pattern is unmistakable: a long low period, a sharp rise, a burst of activity, a return to low. The duration of the burst and the period between bursts are numbers the program computes, and they constrain what the program can be.
This is the cheapest channel and the most underused. It requires a series resistor and an oscilloscope, and it answers questions that would otherwise need the array.
Pin behaviour as an initialisation order
Watching the pins during the first milliseconds after reset shows the order in which the program configures things. The first pin to move is the first thing initialised, and the timing between movements reflects the code between them.
On a device that drives a display, a motor or a bus, that sequence is the start-up specification of the product. It is also the sequence a reimplementation must reproduce, which makes it the most directly useful observation available on a locked part.
Bus traffic as the protocol
If the product communicates with anything, the traffic is readable with the device in place and running normally. There is no protection involved: the bus is outside the device.
Capturing a full operating cycle gives the protocol. Capturing a service or configuration sequence gives the commands. On products with a diagnostic port, the traffic during a service procedure frequently contains more than the procedure requires.
The device’s own export paths
This is the channel that turns a locked device into a readable one, and it is a property of the design rather than of the protection.
Any feature that moves data out of the device can move program data out of the device. A calibration export, a diagnostic dump, a firmware update with a verify step, a debug command left in production firmware — each is a path the original authors built and the protection does not close.
Finding them means enumerating the interfaces and exercising them, which is a day of work that regularly replaces a week of anything else.
The loader, and the password question
Where the loader exists, its password is derived from the device’s own memory rather than stored separately. That creates a dependency worth stating: a device whose vector table can be read has a loader that can be entered, and one whose vector table cannot be read has a loader that cannot.
Which means the loader is a route for devices with intact programs and inaccessible arrays, but only where the vector table is somehow obtainable — from a second unit, from an update file, or from the product’s own documentation.
Everything else on the board
A board carrying a locked microcontroller usually carries other parts that are not locked. Serial memories hold calibration. Identity chips hold serial numbers. Sensors hold factory trim. Analog front ends hold their own correction values.
Reading the whole board before concluding that the project depends on the microcontroller is not a detour. It frequently supplies the parameters that were the actual requirement, and it sometimes supplies enough of the program’s data that the array becomes unnecessary.
When physical access is the only answer
If the requirement is the program itself, and no export path exists, and the loader is closed, then the remaining route is physical. That is a different kind of work with a different kind of cost, and it should be entered with a clear statement of what it can and cannot deliver.
It is also the point at which the honest advice is sometimes to reimplement. A device whose behaviour has been fully characterised through the six channels above can be replaced by a program written against that characterisation. The result is a product that works, which is usually the actual goal, rather than a copy of a program, which is usually the means.
Related reading
- MSP430G2452 and the calibration problem after a copy — the same part, a different question.
- MSP430F2252 and separating locked from damaged — establishing that the first channel is available at all.
- MSP430G2413 and deciding when a project is not worth starting — the judgement that follows from this list.
FAQ
Can the array be read through any of these channels? Only through an export path the program itself provides. The others give behaviour, not content.
Is current measurement really useful? On a low-power product it is the fastest way to see the program’s structure.
Does the loader always exist? No, and where it exists its transport may not be brought out.
Why read the rest of the board first? Because the requirement is often a parameter, and the parameter is often not in the microcontroller.
Conclusion
A locked device is one closed channel and six open ones. Measure the current, watch the pins, capture the bus, exercise the interfaces, check the loader, read the rest of the board, and only then consider the seventh. Most projects that begin with the array turn out not to need it.
MSP430G2352: Why a Restored Device Does Not Start
A restored device that does not start produces a strong temptation to re-examine the transfer. The image must be wrong, the read must have been incomplete, the programming must have failed somewhere. In practice the image is usually fine, and the fault is in one of a small number of places that have nothing to do with how the bytes were moved.
The list below is ordered by frequency. Working through it in order takes an hour and eliminates most of the space before any deeper investigation.
First: is it resetting repeatedly
The most common startup failure on this family is not a failure to start. It is a device that starts and resets roughly thirty times a second, which a slow observer sees as nothing happening at all.
The reason is the watchdog. After reset it is running, in watchdog mode, clocked from a source that gives a timeout measured in milliseconds. A program that does not explicitly hold or reconfigure it will be reset before it reaches its main loop, forever.
| Observation | Interpretation |
|---|---|
| No activity at all, steady current | Device halted or blank |
| Periodic activity at a few tens of hertz | Watchdog reset loop |
| Activity for a fraction of a second then stop | Fault or trap, or a deliberate halt |
| Activity that never repeats | Device entered a low-power mode or hung |
The periodic case is diagnosable with a scope on a single pin that the program touches early, or with a supply current measurement that shows a regular pattern.
Second: the reset vector
The reset vector is one word at a fixed high address, and it is the only thing the device reads before it executes anything. If it is wrong, nothing else matters.
Three ways it goes wrong:
- The image did not include the vector table, because the linker placed it in a section that was not copied.
- The vector was written, but to the wrong endianness or with a byte offset, because the transfer treated the image as bytes rather than as words.
- The vector points at an address that was not programmed, which produces execution of erased flash.
Reading the two words at the top of the array and comparing them against the source is a thirty-second check. It should be the first check, not the last.
Third: the clock
A device whose clock is not running behaves like a device with a broken program. The core needs a clock to execute and the flash controller needs one to be read.
Two causes are common after a restoration. The oscillator configuration registers were not copied because they are set by the startup code and the startup code is correct, in which case there is no problem. Or the calibration for the internal oscillator is missing from the information region, in which case the device runs at a frequency far from the intended one.
The second case does not usually prevent a start. It produces a device that runs slowly, which can look like a failure if the program’s first action is a timed wait with a large constant.
Fourth: the supply
Flash programming and flash reading both require the supply to be within specification, and reading is the less forgiving of the two at low voltage.
A restored device tested on a bench supply at the nominal voltage can fail on the product’s own converter if that converter is marginal or slow to rise. The symptom is a device that works when probed and fails when installed, which is the most confusing presentation of the whole list.
Measuring the supply at the device pins during the first milliseconds after power-up, not after it has settled, is the check. A supply that rises slowly through the region where the core is trying to start produces a device that starts sometimes.
Fifth: the reset line
A reset line with the wrong capacitor, or with an external driver holding it, prevents the device from ever leaving reset. The device is powered, the current is normal, and nothing happens.
This is a board fault rather than a restoration fault, and it is the reason a restored device should be tested in a known-good board before the customer’s board is implicated. A device that works in one board and not another has located the fault in the board.
Sixth: the program itself
Only after the five above is the image the suspect. At that point the useful checks are the ones described elsewhere: the vector table pointing into the programmed region, the first instructions disassembling as startup code, the reset vector inside the array.
A specific failure worth knowing: a device whose image was read from a unit that had been in service may contain a state that the program expects to persist — a flag in the information region saying the device is commissioned, a checksum over a parameter block, a counter. Restored into a device without that state, the program takes a branch it never took in the original and stops.
The check is to read the source’s information region as well as its main array, and to compare the two devices’ non-volatile state rather than only their code.
A procedure that finds it in an hour
- Scope a pin the program drives early. Classify the behaviour against the table above.
- Read the top two words of the array and confirm them against the source.
- Measure the supply at the device at power-up, not after.
- Confirm the reset line reaches its inactive level.
- Try the device in a second, known-good board.
- Read the information region of both devices and compare.
- Only now re-examine the image.
Steps one and two resolve the majority of cases. Step five resolves the argument about whether the fault is the device or the board, which is otherwise unresolvable through discussion.
Related reading
- MSP430G2452 and the calibration values behind a device that runs but misbehaves — the next failure mode after this one.
- MSP430G2152 and what a successful copy is supposed to mean — the standard this procedure tests against.
- MSP430G2212 and reading the top of the array first — where the vector table comes from.
FAQ
Why does the watchdog cause a reset loop? It is running after reset and times out in milliseconds unless the program holds it.
Can a wrong calibration prevent a start? Rarely. It usually produces a device that runs at the wrong speed.
How do I know the fault is the board? Test the same device in another board.
Is a verified image proof that the restoration is correct? It is proof that the bytes arrived. Everything else is separate.
Conclusion
A restored device that does not start is usually not an image problem. Check for the watchdog loop, check the reset vector, check the clock, check the supply at the device, and test in a second board before doubting the transfer. The order matters more than the depth of each check.
MSP430G2252: A Binary, a Disassembly and a Project Are Three Deliverables
The word firmware covers three artifacts that are not interchangeable. A binary is a sequence of bytes at addresses. A disassembly is those bytes with the machine code turned back into instructions and named. A project is something a compiler accepts and a person can modify.
The difference is not cosmetic. Each level enables a different set of future operations, and the effort separating them is not linear. Most disagreements about recovery work come from a customer expecting the third level while the quote was written for the first.
What each level lets you do
A binary lets you reproduce the device. Program it into a blank part and you have the product back. Nothing else is possible: it cannot be modified, it cannot be recompiled for a different memory map, and it cannot be reviewed.
A disassembly lets you understand and patch. You can read the program, find the constant you need to change, and alter a byte or two. This is enough for a surprising number of real requests, including changing a hard-coded serial number, removing a check, or adjusting a delay.
A project lets you maintain. Add a feature, change a peripheral, port to a different device, hand it to a developer who was never involved in the recovery.
| Deliverable | Enables | Typical effort |
|---|---|---|
| Binary | Reproduction | Hours, dominated by extraction |
| Disassembly, annotated | Understanding, small patches | Days |
| Buildable project | Maintenance, porting | Weeks to months |
The patch route and why it works more often than people expect
Between the binary and the project there is a practical middle that is worth knowing because it covers most modification requests at a fraction of the cost.
The technique: keep the original image, find free space in the flash that the program does not use, assemble the new routine into that space, and change the original function’s first instruction into a jump to the new location.
Three details decide whether this works.
Free space. A program this size usually leaves the region between its last section and the top of the array unused, or leaves erased pages inside its own extent. Either is usable.
Jump range. The jump instructions on this core have a limited offset. Reaching a distant address needs a two-step construct: a conditional jump to a nearby unconditional branch, or an absolute branch instruction. A patch that assembles but silently jumps to the wrong address is the classic failure here.
Absolute addresses. Anything in the original code that references the modified function by address — a vector entry, a function pointer in a table — still points at the original location. Changing the first instruction to a jump handles that, because the original address now executes the branch.
The patch route fails when the change is large. Adding a routine is easy; restructuring a state machine is not.
What the disassembly actually needs
An annotated disassembly is only useful if the annotation is real. A listing with addresses and instruction mnemonics is barely better than the binary, because the reader still has to work out what each routine does.
The annotation that earns its place:
- a name for every routine, derived from what it does,
- a comment on every peripheral access, naming the register and the field,
- the state machine drawn out, if the program has one,
- the constants tabulated with their meaning,
- the memory map, including the information region.
That is the deliverable that answers the question a customer usually has, which is not how do I rebuild this but what does it do.
When a project is genuinely required
Four situations justify the full route.
The product has to be ported to a different device, because the original is obsolete or unavailable. Porting requires the source to be recompiled against a new memory map, and a binary cannot be recompiled.
The program has to gain a feature that changes its structure rather than its constants. Any change that adds state cannot be patched into free space without becoming an exercise in assembly programming.
The product is subject to a process that requires reviewable source. A regulator or a customer’s quality system may require it, regardless of the technical need.
The product will be maintained for years by someone who did not do the recovery. A disassembly is a snapshot; a project is a working environment.
Setting the expectation
The honest way to quote this work is to state the level explicitly and describe what each level costs, then let the customer choose. That conversation takes ten minutes and prevents the most common failure in this business, which is a delivery that meets the letter of an agreement and not the need behind it.
A useful question to ask: what do you want to do with it in two years. If the answer is nothing, the binary is enough. If the answer is change one number, the disassembly is enough. If the answer involves a new board, the project is the only answer.
What the binary level still gives you
It is worth not dismissing the first level. For an obsolete machine where the goal is to keep one unit running, a binary plus a programmed spare part is the entire requirement, and it is deliverable in a day.
Adding annotation to that binary is the cheapest upgrade available, and it is usually worth doing even when nobody asked, because it converts an opaque artifact into a maintainable one at a cost measured in hours.
Related reading
- MSP430G2131 and the case where the image has two programs in it — a structure that changes what the deliverable should be.
- MSP430G2444 and the analysis that turns an image into a specification — the work between the second and third levels here.
- MSP430G2121 and the instruction set that makes reading practical — why the disassembly level is reachable on this architecture.
FAQ
Can a binary be turned into source automatically? A decompiler produces something that resembles source and does not rebuild. It is a reading aid.
Is patching in free space safe? Safe if the jump range and the absolute references are handled. Both are checkable.
Why is the project level so much more expensive? Because every function has to be understood well enough to be rewritten, not merely read.
What should be delivered with a binary? At minimum, the memory map, the vector table and the checksum.
Conclusion
Binary, disassembly and project are three products with three prices. Name the one being delivered, ask what the customer intends to do with it in two years, and use the patch route when the change is small. Most requests that sound like they need a project need an annotated disassembly and one afternoon.
MSP430G2152: Three Different Standards for a Successful Copy
Two people can agree that a copy works and mean different things. One means the file compares equal. One means the product does what the original did. One means the product behaves the same in every circumstance the original was ever exposed to, including the ones nobody wrote down.
Those are three different claims with three different costs, and a duplication job that does not establish which one is required will be judged against the strictest one available at the moment of delivery.
The three standards
Byte identity is the easiest to state and the easiest to verify: the destination’s array, read back, equals the source’s array. It is also the weakest claim, because two devices with identical arrays are not necessarily identical in behaviour.
Functional equivalence means the destination performs the product’s function: it starts, it responds, it controls what it is supposed to control. This is what most customers actually need, and it is verifiable with a test procedure rather than a memory comparison.
Behavioural equivalence means the destination is indistinguishable from the source under any input, including timing, power consumption, start-up transients and edge-case behaviour. This is a research programme, not a test.
| Standard | Evidence required | Cost | What it misses |
|---|---|---|---|
| Byte identity | Readback comparison | Minutes | Everything about behaviour |
| Functional equivalence | Test procedure on the product | Hours | Untested conditions |
| Behavioural equivalence | Exhaustive comparison across conditions | Weeks | Nothing, if done fully |
Why byte identity is not enough
The array does not contain everything that determines behaviour. Two things it does not contain are the calibration of the individual die, which lives outside the array, and the analog characteristics of the silicon, which are not stored anywhere.
A destination whose array matches the source exactly will therefore differ from it in clock accuracy if the calibration was carried across, and will differ in it in the opposite direction if it was not. Either way the arrays are identical and the devices are not.
There is also a class of difference that byte identity actively conceals: a copy that is byte-identical to a corrupt source is a faithful reproduction of a fault. If the source’s image contained a damaged constant, the copy inherits it and passes every comparison.
Why behavioural equivalence is not achievable
The claim requires knowing the full input space, which nobody does. It also requires reproducing characteristics that are properties of a specific die, which cannot be copied at all.
What can be done is a bounded version: define the conditions the product operates in, test at the corners of that region, and state the region in the delivery. That is a defensible claim, and it is honest about its boundary.
Designing the acceptance test
The useful approach is to build the test from the product’s function outward, in layers, and to stop adding layers when the marginal cost exceeds the marginal confidence.
- Does it start? Power cycle, confirm the device reaches its operating state within the expected time.
- Does it respond? Every external interface the product has, exercised with a known input, output compared against the source.
- Does it control? The actuator, display, or output path driven to a known state and measured.
- Does it measure? Any analog input swept across the product’s range, with the reading compared against the source at each point.
- Does it hold at the corners? Supply and temperature at the limits the product specifies, with the functional tests repeated.
Layers one to three catch the majority of duplication faults. Layer four catches the calibration errors that layer three cannot see. Layer five catches the ones that only exist at the edges, which is where field failures come from.
The comparison baseline
Every test above needs a source device in known-good condition, and that baseline is the part of the job that gets the least attention.
A source unit that has been in service for years is not a known-good reference. Its calibration may have drifted, its analog path may have aged, and its behaviour may differ from a new unit of the same product. Comparing a copy against it produces a copy that matches a worn original, which is not what the customer meant.
Where possible the baseline should be a unit the customer considers good, tested against its own specification before being used as a reference. Recording the baseline’s measurements with the delivery turns the acceptance test into something the customer can repeat.
What to write down
The delivery should state, explicitly:
- which standard was met, in the terms above,
- which conditions were tested and which were not,
- the measurements taken on the baseline and on the copy, side by side,
- the fields that were deliberately changed, and why,
- the known differences that were accepted, and the reasoning.
The last item is the one that prevents arguments. Every duplication has known differences. Stating them at delivery converts a future complaint into a recorded decision.
Where the standards diverge in practice
A device used as a measurement instrument is usually held to functional equivalence at the corners, because its function is accuracy.
A device used as a controller is usually held to functional equivalence, because its function is sequence.
A device used in a safety path is held to something stricter than either, and that is a conversation to have before any work starts rather than after a device has been produced.
Matching the standard to the product is the judgement this article is asking for. Applying the strictest standard to everything makes the work unaffordable; applying the loosest makes it worthless.
Related reading
- MSP430G2452 and the calibration values that decide the outcome — the single most common cause of a copy that starts and misbehaves.
- MSP430G2352 and diagnosing a copy that will not start — the first layer of the test, in detail.
- MSP430G2444 and the analysis that supports an equivalent — what to do when the standard cannot be met by copying at all.
FAQ
Is byte identity ever the right standard? When the customer’s own process verifies it and accepts the limits.
Can behavioural equivalence be certified? Only within a stated envelope. Outside it, nothing is certified.
Why compare against a baseline device? Because a copy is only meaningful relative to something known to be good.
What if the source is not available? Then the standard is equivalence to a specification, which is a different project.
Conclusion
Decide the standard before the work. Byte identity is a file comparison, functional equivalence is a test procedure, and behavioural equivalence is a bounded claim about a stated envelope. Name the one you are delivering, test to it, and record the differences you accepted.
MSP430G2412: The Security Fuse Is a Flash Word, Not a Fuse
The word fuse is a metaphor that has outlived its usefulness. A fuse is blown once, it is physical, and its state is unambiguous. The mechanism on this device is none of those things: it is a location in the flash array, programmed by the same controller that programs everything else, and read by the protection logic on every access.
Understanding that changes what the failure modes are. A physical fuse either conducts or it does not. A flash word can be programmed, erased, partially programmed, worn, or read differently at two temperatures — and the protection logic has to interpret all of those states with a single comparison.
What the mechanism actually is
The array has a special location that the protection logic consults. While that location holds its erased value, external access is permitted. Once it is programmed to the locking value, external access is denied.
Three properties follow directly.
The state is reversible in principle, because erasing the array erases the location with it. The reversibility is not useful, because erasing the array destroys the program that was being protected.
The state is per-device and applies to the whole array. There is no region-by-region protection, which is why the protection question is always answered with one bit.
The state can be intermediate. Programming a flash word means driving charge onto a floating gate, and a write that is interrupted, under-powered, or performed at the edge of the temperature range can leave the cell between the two states.
The three states and how they behave
| State | Mechanism | Observable behaviour |
|---|---|---|
| Erased | Location holds its erased value | Access permitted |
| Programmed | Location holds the locking value | Access denied, consistently |
| Marginal | Charge insufficient to read as the locking value at all conditions | Access sometimes permitted |
The third row is the one that wastes weeks. A device in that state produces a session that reads the array, then fails to read it, then reads it again, with no change in the setup. The natural conclusions are a bad cable, a bad tool, or a failing device, and all three are wrong.
Why marginal states exist
Programming is not instantaneous or absolute. The controller applies a pulse and checks the result; a cell that does not reach the target after the specified pulses is reported as a failure. In a controlled programming operation that report is reliable.
The marginal case arises when the programming was not controlled: a supply that drooped during a production programming step, a write performed at a temperature outside the specified range, a device that had already been through many cycles, or a write that was interrupted by a reset.
Each of those produces a cell with less charge than intended. It reads as locked at room temperature with a fresh supply and reads as open when the temperature rises or the supply sags, because the read margin is what changed.
Recognising it
The signature is a device whose behaviour depends on conditions rather than on the setup.
- Read the same address repeatedly at constant temperature and supply. A marginal device gives a consistent answer within a session.
- Change the temperature and repeat. A marginal device changes its answer; a properly programmed one does not.
- Change the supply within its specified range and repeat. The same applies.
- Compare the reported state against the history of the unit. A device that was working and stopped after a power event is a candidate; one that never worked is not.
Step four is the discriminator between a marginal fuse and a design that never allowed access. If the product has been in service and its firmware has been updated in the field, the device must have been accessible at some point, which means the current refusal is a change of state rather than a policy.
What can be done about it
The options depend on which direction the marginality runs.
If the device is marginally locked, the goal is to complete the programming so that the state becomes stable, or to read the array during a window when the cell reads as open. The second is not a technique so much as an observation: a marginal cell that reads as open at an elevated temperature will do so reliably at that temperature, and a session conducted there either succeeds or fails consistently.
If the device is marginally open, the danger is the opposite. A read taken while the cell is marginal may be interrupted when the cell stabilises, and the resulting image is truncated. The mitigation is to read quickly and verify, and to accept that the window may not be long.
In both cases, recording the temperature and supply at which each attempt was made is the difference between a repeatable procedure and a story.
What must not be done
The tempting response to an unstable state is to erase and start clean. On a device whose program is the thing being protected, an erase removes the content and the fuse together, and the result is a blank device with no protection and nothing to protect.
That is worth stating plainly because it is the single irreversible mistake available here. Erasing is a legitimate step when the array has already been read and the goal is to reuse the part. It is never a diagnostic.
The wider point about fuse metaphors
The same confusion appears across the family: documentation and habit describe the protection as a fuse, technicians look for a physical structure, and the reasoning that follows is about physical structures.
Keeping the flash-word model in mind produces better questions. Can the state be read? What does an interrupted write do to it? Why would a device change state without being written? Those are answerable. Questions about blown fuses are not.
Related reading
- MSP430F2252 and separating a locked device from a failing one — the diagnosis this article extends.
- MSP430G2513 and what customers mean by unlocking — a vocabulary problem that follows from the same metaphor.
- MSP430G2212 and reading the top of the array first — a procedure that benefits from knowing the state early.
FAQ
Can the fuse be reset without losing the program? No. The same erase affects both.
Is a marginal fuse common? Uncommon, and memorable, because the symptom looks like a hardware fault.
Does temperature really change the read result? For a cell with insufficient charge, yes, and that is the definition of marginal.
Is it ever right to erase a locked device? Only after the content has been read.
Conclusion
The lock is a flash word, which means it has flash word properties: programmable, erasable, and capable of sitting between states. Treat an inconsistent device as a marginal cell rather than a broken one, record the conditions of every attempt, and never use an erase as a diagnostic.
MSP430G2312: Debugging a Device That Sleeps for a Living
The defining feature of a product built on this family is not its peripherals. It is that the core is asleep for almost the entire life of the product. A sensor node wakes for a few microseconds to sample, computes for a few hundred more, transmits, and returns to a mode where the main clock is stopped.
That design is correct engineering and it is hostile to a debug session. The interface is not disabled and the protection is not involved. The problem is that there is almost no time during which the core is in a state where a debugger can take control of it.
Why a sleeping device resists a connection
A debug connection is not a passive attachment. To halt the core, take a breakpoint, read memory through the core’s own address path, or start a flash operation, the tool needs the device in a state where those operations are meaningful.
In the deepest low-power modes the main clock is stopped and the core is held. Some operations still work, because the interface has its own clock and can reach memory directly. Others do not, and the ones that do not are usually the ones the extraction needs: anything that requires the core to execute, and anything that requires the flash controller to be timed.
The result is a connection that half succeeds. The tool identifies the device, reads a register or two, and then fails when it tries to do something that needs a running core.
The window problem
The more common failure is not the deep sleep itself but the duty cycle of wakefulness.
| Phase | Duration | Debugger opportunity |
|---|---|---|
| Reset to first sleep | Milliseconds | Full control if caught here |
| Awake, sampling | Microseconds to milliseconds | One halt attempt, maybe |
| Asleep | Seconds | Interface only, core unavailable |
| Wake on interrupt | Microseconds | Race with the program’s own code |
A tool that attempts to connect by polling will almost always poll during the long sleep, conclude that the device does not respond, and report a failure. The device is responding; it is simply not in a state where the request means anything.
The techniques that work
Four approaches, in the order they should be tried.
Catch the reset. Set a hardware breakpoint at the reset vector before releasing the device from reset. The program stops before it has a chance to enter its first low-power mode, and from that point the debugger is in control and the program can be single-stepped into the sleep and back out.
Hold the device in reset and configure first. Many tools allow the debug interface to be established while the core is held, so that breakpoints and configuration are in place before the first instruction executes.
Wake it externally. If the product has a wake source that can be triggered on demand — a button, a bus message, a sensor edge — generating that event on a controlled schedule turns an unpredictable window into a predictable one.
Change the wake period. On a unit that is not the only copy, or on a device whose program can be replaced, modifying the timer period to something short makes the device nearly continuously awake and removes the problem entirely.
The first is the correct default. It costs nothing, it works regardless of what the program does afterwards, and it fails only when the reset vector itself is not accessible.
Why the supply current matters
There is an electrical dimension to the same problem. A device in its deepest low-power mode draws so little current that some debug tools, which detect a target by measuring the supply, do not see one.
The symptom is a tool that reports no target while a multimeter shows the device is powered. The fix is to tell the tool to skip detection, or to power the board from a supply the tool controls.
This is worth knowing because it produces a failure that looks exactly like a hardware fault and is a configuration option.
What to read once you are in
With the core halted at the reset vector, the order of work is the one used on any other device, with one addition.
Read the vector table first, then the startup code. The startup code of a low-power design is unusually informative: it configures the clock system, sets up the wake sources, and initialises the peripherals that will be used after each wake. That sequence is a specification of the product’s power strategy, and on a device whose application logic is small, the power strategy is most of the design.
Next, identify the low-power mode transitions themselves. The instruction that enters a mode is distinctive, and the code around it shows what had to be done before sleeping and what is restored on wake. On a device that spends its life there, that code is the main loop.
When the device is genuinely closed
If the connection succeeds and the array is refused, the sleep behaviour is irrelevant and the protection question takes over. It is worth being clear that the two are separate: a device that will not connect is not evidence of protection, and a device that is protected may connect perfectly.
The behavioural observations that the low-power design makes available are, however, unusually rich. A device that sleeps and wakes on a schedule is producing a timing signature, and a device that transmits after each wake is producing a data signature. On a product that reports anything at all, that is a channel.
Related reading
- MSP430G2211 and the electrical reasons a connection fails — the other cause of the same symptom.
- MSP430F2252 and separating locked from damaged — what to conclude when nothing responds at all.
- MSP430G2412 and the fuse as a flash location — the state that actually blocks a read.
FAQ
Does the debug interface stop working in low-power mode? It does not stop, but operations that need the core or a running clock do.
Why does the tool report no target on a powered board? Because the current is too low for the tool’s detection.
Can a breakpoint be set before the first instruction? Yes, and that is the standard technique for sleeping targets.
Is a sleeping device harder to extract than a busy one? Harder to connect to. The array itself is no different.
Conclusion
A device that sleeps is not a device that resists debugging; it is a device with a very small window. Catch the reset, hold the core before releasing it, and the window stops mattering. Everything after that is the ordinary work of reading an array that either opens or does not.
MSP430G2212: Reading an Image From the Top Down
The address order of a memory read is normally inherited from the tool rather than chosen. Tools read from the base of the array upward, because that is how the hex file is laid out and how the programmer writes it. For extraction the direction is not a formatting detail; it decides what you have when the session ends early.
Sessions end early often. A supply glitch, a watchdog, a thermal shutdown, a protocol timeout, a cable moved — any of these stops the transfer somewhere in the middle. What you hold afterwards depends entirely on which end you started from.
What lives at the top
On this device the highest addresses hold the part of the program that describes the rest of it.
The interrupt vector table sits at the top of the address space. It contains the reset vector, which is the entry point, and one entry per interrupt source, which is a list of the peripherals the program uses. Reading it first tells you where execution starts and which modules matter.
The protection state is established by a location the module compares against, and that location is in the same high region. Knowing it early means knowing whether the transfer is going to work at all.
Below the vectors is the code that the vectors point into: the startup routine, the interrupt handlers, the main loop. This is the part of the program that a person reads first anyway, so reading it first means the analysis can begin before the extraction has finished.
| Region | Position | Why read it first |
|---|---|---|
| Vector table | Top of the address space | Gives the entry point and the peripheral list |
| Protection state | High addresses | Decides whether the session can succeed |
| Startup code | Just below the vectors | The first thing an analyst needs |
| Application and tables | Lower addresses | The bulk, and the least structurally informative |
The argument for top-down
Three benefits follow, and they compound.
A partial image is still useful. A read that stops after the top region yields a complete vector table and the startup code, which is enough to identify the compiler, the peripheral set, the main loop structure and the entry point. A read that stops after the bottom region yields a fragment of an unknown function with no entry point.
The failure is diagnosed sooner. If the protection is engaged, a top-down read discovers it in the first block rather than after transferring everything readable below it. On a device with partial protection — rare but not unknown — that difference is the whole session.
The transfer can be prioritised. When the link is slow and unreliable, the valuable part can be fetched first, verified, and stored, and the rest fetched afterwards with a different strategy if necessary.
How to implement it
The routine is the same one used for any block transfer with three changes.
- Start the address counter at the top of the implemented array rather than at its base.
- Align the first block so that it ends exactly at the top, rather than starting at a round number below it.
- Descend in blocks that stop at bank boundaries rather than crossing them, so that a failure is confined to one bank.
Step two matters more than it appears. A block that is aligned to its end rather than its start keeps the vector table inside one transfer unit, which means the transfer succeeds or fails as a whole rather than arriving with its last few entries missing.
Reading the vectors as a map
The vector table is worth more than its content. Its shape is a description of the program.
A vector that points into the middle of the array with the low bit set is an interrupt handler. A vector that points to the same address as another is a shared handler, which means the design groups several sources into one routine. A vector that points at erased flash is an unused source. A vector that points outside the array is either a bug or a signal that the image is not what it appears to be.
Recording that classification takes minutes and produces the peripheral list without disassembling a single instruction. On a device whose program cannot be read but whose behaviour can be observed, the same classification can be reconstructed from which interrupts the hardware actually takes — which is the only route available on a fully locked part.
What the down direction costs
There is one real disadvantage: the linker’s map is organised from the bottom, so section boundaries, tables and constant pools appear in the image in an order that no longer matches the order in which you read them.
The mitigation is to keep an address-indexed store rather than an append-only file. Write each block to its offset in a sparse image, and the order of arrival becomes irrelevant. A sparse image that is half full is a legitimate intermediate state and can be inspected, which an append-only dump cannot.
Verifying a partial read
A top-down session that was interrupted leaves a specific shape: vectors present, code present to some depth, and erased or missing data below. That shape is easy to verify.
- Confirm the reset vector points inside the region that was actually read.
- Confirm the first instructions at that vector disassemble into plausible startup code.
- Confirm the vector entries point into the read region, not into the missing part.
- Confirm the read region ends on a block boundary, which shows where the session stopped.
Step three is the useful one. If the vectors point below the deepest address read, the remaining region is not optional: it contains the handlers, and the image is incomplete in a way that matters.
When the whole array is unreadable
The top-down discipline has a second use in the case where nothing can be read at all. The same map can be built from behaviour: which pins respond, which interrupts occur, which peripherals are initialised in what order. On a part this small that reconstruction is realistic, and it produces the same document — entry point, peripheral list, module structure — from observation rather than from memory.
That is the fallback, and it is worth keeping in mind while reading the vectors of an open device: the classification you are doing is the same one you would have to do from the outside if the array were closed.
Related reading
- MSP430G2101 and reading a whole image by hand — what to do with the vectors once you have them.
- MSP430G2211 and the electrical failures that end sessions early — why the direction matters in practice.
- MSP430G2513 and the different meanings of unlocking — what to do when the top region says the array is closed.
FAQ
Does the tool support reading downward? Usually not directly, but block reads at chosen addresses can be issued in any order.
Why align a block to its end? So that the vector table is not split across two transfers.
Is a partial image worth keeping? A top-down partial image usually is. A bottom-up one usually is not.
Can vectors point outside the array? Not in a correct program. If they do, the image or the read is wrong.
Conclusion
Read from the top. The vectors, the protection state and the startup code are what make an image interpretable, and having them first means that a session which ends early still produces something an analyst can use. The direction costs nothing and changes what a failure leaves behind.