TMS320F28067: What “Locked” Actually Means at the Flash Controller
The word “locked” suggests something physical: a gate closed over the memory array, sealed after programming. On the F28067 that picture is wrong in a way that matters, because it leads people to expect the wrong failure modes. The lock is a comparator sitting on the read path between the flash array and everything that can request data from it. The array still holds what it holds. The comparator decides whether the requester is allowed to see it.
Once that is clear, several confusing observations stop being confusing: why a protected read returns a clean zero rather than an error, why the code security module can be released by a value that is itself stored in the protected memory, and why a mass erase unlocks a part while leaving the array in a state that has nothing to do with protection.
The lock is a comparator, not a fuse
The code security module on this family watches the addresses that a read is coming from and the addresses it is going to. If a request originates outside the secure space and targets inside it, the module substitutes a zero for the data and lets the read complete normally. No bus fault, no exception, no error flag that firmware could detect.
That choice was deliberate. A protected read that faulted would tell an attacker exactly where the boundary is and would let firmware probe the boundary from inside. A protected read that returns zero is indistinguishable, at the instruction level, from a read of genuinely erased or genuinely zeroed memory.
The practical consequence: a locked part does not refuse to talk. It answers, politely, with zeros.
Where the password lives
The 128-bit password — eight 16-bit words — occupies the top of the flash address space, in the same array as the code. It is not in a separate OTP block on this family, and it is not a one-time structure. That single design decision creates most of the interesting behaviour around these parts.
| Property | Consequence |
|---|---|
| Password stored in flash | Erasing the password sector destroys the password |
| Password erasable by mass erase | A locked part can be returned to an unlocked state |
| Password also erasable by sector erase | An interrupted erase can leave a partial password |
| Password location readable when unlocked | The value can be confirmed before it is lost |
The third row is the one that produces support cases. A device that was erased sector by sector, with the erase interrupted before the password sector completed, can end up with a password that is partly FFFF and partly original. The part is then neither locked with the original password nor blank — it is locked with a value nobody knows. It reads as a perfectly healthy, permanently locked part.
Why every read comes back zero
Reading zero is not the same as reading “nothing”. Two very different devices return the same result:
- A part whose secure memory was erased and never rewritten.
- A part whose secure memory is full of code and whose comparator is substituting zeros.
Telling them apart requires information the read path is specifically designed not to give. Size does not help — the flash size is documented and identical in both cases. Timing does not help — the substitution happens after the array access, so the access time is unaffected.
What does help is anything outside the protected space. The boot ROM, the peripheral registers, the OTP area that holds part identification, and the behaviour of code that was never inside the secure region all remain readable, and each of them carries a little evidence about what the device is.
The reset state, and what releases it
After reset the module is locked. Unlocking means presenting the 128-bit value to the key registers in the correct order. Get the order wrong, or present a value that differs in one bit, and the module requires a reset before it will accept another attempt. That lockout-after-failure behaviour is the reason automated password guessing does not work here in the way it works against parts with a counter that merely slows down.
The module also has to be unlocked before the debug interface can read secure memory. JTAG remains functional — the CPU can be halted, registers inspected, peripherals exercised — but memory reads from the secure region return zeros exactly as they do for the CPU. This is a frequent source of confusion: a debugger that connects successfully is not evidence that the part is unprotected.
Mass erase: the documented exit
The documented way out of the locked state is a mass erase, which clears the whole array including the password sector. After it, the part is unlocked by definition, because there is no password left to compare against.
This is not an attack and it is not a secret. It is the mechanism that lets a contract manufacturer recover a part whose password was lost, and it is available through the programming interface on an unlocked-for-erase part.
The cost is total: the program, the constants, the calibration data and the password all go. A mass-erased F28067 is a new part with a used package.
What actually survives
If the goal is to get the program back rather than to get the part back, a mass erase is the end of the story for that die. What survives is everything that was never in the array:
- The build the device came from — if another unit of the same product exists, its image is the same image.
- Any update package the product ever accepted, if the delivery path is recoverable.
- The observable behaviour of the device, which constrains what the image must contain even when the image itself is unavailable.
That last item is routinely undervalued. A locked part that still runs tells you its instruction mix, its peripheral usage, its timing, and its response to stimulus. None of that is the image, but all of it narrows the image to a small space.
Restoring a program to a part you cannot read
“Restoring” is a different operation from “reading”, and it is worth keeping the two apart.
Restoring means writing a known image back onto a device. It requires the image to exist somewhere — a backup, a sibling unit, a released firmware package — and it requires the configuration that goes with it: clock setup, peripheral muxing, boot mode. A restored part that runs but behaves subtly differently is almost always a part restored with the right code and the wrong configuration.
Reading means obtaining an image that does not exist anywhere else. On a locked F28067 that is not a firmware operation at all. No sequence of register writes produces it, because the comparator is on the read path and there is no register that turns the comparator off without the password.
The distinction determines what to do first. If an image exists, the job is procedure: erase, program, verify, and confirm the configuration words match the original. If no image exists, the job is measurement and inference, and the honest expectation is that it will produce a functional equivalent rather than a byte-identical copy.
Where the time actually goes
In practice, most of the effort on a locked F28067 goes into establishing which of those two situations applies. Teams often begin by assuming the image is gone, spend time on the wrong problem, and later discover a sibling unit in a drawer. The reverse also happens: a team assumes a backup exists, restores the part, and finds the backup was of a different build.
Both failures are cheap to avoid. Reading the part identification and OTP area, comparing behaviour against a known-good unit, and confirming the firmware version the device reports will put the case in the right category within an hour.
Related reading
- TMS320F2809 and the password read sequence — the unlock order and why a failed attempt costs a reset.
- TMS320F28075 and dual-zone security — what changes when the array is split into two zones instead of one.
- TMS320F2812 and the external bus — the case where the program was never in the protected array to begin with.
FAQ
Does a locked part still boot? Yes, normally. The comparator restricts reads from outside the secure space; the CPU fetching its own code from inside that space is the intended case.
Can the debugger read memory on a locked part? It can connect, halt the core and inspect registers. Memory reads from the secure region return zeros until the module is unlocked.
Does mass erase damage the part? No. It clears the array. The part is fully usable afterwards, with no program on it.
Is the password recoverable if it was never written down? Not from the device. The password is a value stored in flash; once the sector holding it is erased, there is nothing left to recover.
Why does a protected read return zero rather than an error? Because an error would reveal the boundary. Zero is indistinguishable from erased or zeroed memory, which is the point.
Conclusion
The F28067 lock is an access decision made on the read path, keyed by a value stored in the memory it protects. That single arrangement explains the zeros, the mass-erase exit, the reset-after-failure behaviour and the fact that a functioning device can be permanently unreadable while being electrically perfect. Separating “restore” from “read” is what turns the problem from an impossible one into a decidable one.