TMS320F2809: The Unlock Sequence and Why Order Matters
Every protected part has an unlock procedure, and most of them are one operation: write the right value to the right register. The code security module on this family is not like that. It expects a sequence with a precondition, a strict order, and an all-or-nothing outcome, and the failure mode is not an error message but a silent return to the locked state that only a reset clears.
That design is intentional. A single-write unlock can be attacked by writing candidates in a loop; a sequence that costs a reset per failure cannot. The cost to legitimate work is that the sequence has to be known exactly, and it is the kind of detail that is easy to read past in a datasheet.
The precondition
Before the key registers accept anything, the module expects the password locations to have been read. This is sometimes described as a dummy read: the values returned are the password in plain form when the device is unlocked, and zeros when it is locked.
The reason for the requirement is architectural rather than cryptographic. The read primes the module’s expectation — it confirms that a requester exists and has addressed the password region. Skipping it means the subsequent writes go nowhere, and the module reports nothing.
On a locked part the dummy read returns zeros, which is exactly what a genuinely blank part returns. So the first attempt on a locked device also serves as the test: if the dummy read returns the password you expected, the part was never locked and the rest of the sequence is unnecessary.
The sequence
The order that works:
- Read each of the eight password locations as 16-bit reads, in ascending address order.
- Write the eight password words to the key registers, low word first.
- Read back a known code address and confirm it is not zero.
The third step is not a formality. The module gives no acknowledgement of success, so the only evidence of an unlocked state is data that was previously hidden becoming visible.
| Step | What it does | What happens if skipped |
|---|---|---|
| Dummy read | Primes the module | Key writes are ignored |
| Key writes in order | Compares against the stored password | Comparison never completes |
| Read-back check | Proves the state | Failure is mistaken for success |
Why a failed attempt costs a reset
After a mismatch, the module refuses further attempts until reset. This is the part of the design that people find most irritating and it is also the part that makes the mechanism meaningful: without it, an eight-word password of 128 bits would be reducible by iteration, because each attempt is cheap.
The practical implication is that any automated attempt must be correct before it runs, not corrected while it runs. A loop that tries variations and checks after each one will perform one comparison and then spin, because every iteration after the first is ignored.
Reading the module’s state instead of guessing
There are places the module’s state shows through, and they are worth knowing because they turn a guess into a measurement:
- Boot behaviour. A part whose code is intact boots. A part whose code is erased does not. On a locked part both look identical from outside, but the boot time differs measurably, because a part with valid code runs initialisation before settling.
- The OTP and identification area. Readable regardless of lock state. It will not tell you the password, but it tells you the silicon revision, which decides which programming algorithm applies.
- Peripheral state after reset. A part whose firmware initialised peripherals and is now running shows configured registers. A blank part shows reset defaults. This is the most direct evidence available from outside the secure region.
The third item is underused. A single read of the clock and GPIO configuration registers, taken over the debug interface on a part that has been left running, distinguishes “programmed and executing” from “erased” without touching protected memory at all.
What the password is, and what it is not
The password is a 128-bit value stored in flash, and it protects against reads. It does not encrypt anything. The code behind it is not scrambled; it is stored in the ordinary way and gated by an access check.
This matters for expectations. There is no key derivation, no cipher, no entropy involved. Consequently there is nothing to cryptanalyse. The only ways past the check are to know the value or to remove the mechanism from the equation — which is a physical question, not a firmware one.
It also means the password is only as strong as its source. Values derived from the product name, the build date, or a sequence number are not defeated by computation; they are defeated by knowing how the vendor names things, which is a research question about the vendor rather than about the chip.
When the sequence cannot help
Two situations exist where the sequence is irrelevant:
The password location is partially erased. An interrupted sector erase can leave the password neither original nor blank. The module compares against a value that no record contains, and nothing recovers it.
The password was never programmed. Then the locations read as FFFF and the device is open — the sequence succeeds trivially, and the interesting question becomes why anyone believed it was locked. This happens more often than expected: a part reported as unreadable is sometimes a part whose protection was configured in the wrong word, and whose array was never gated at all.
Verifying a break, honestly
A break is proven by reading memory that was previously zeros and getting code back — and then by confirming the code is coherent: a valid reset vector, an initialisation sequence, branches landing on instruction boundaries.
Reading a non-zero value once is not proof. A partially successful unlock, a stale buffer in the debug tool, and a misread at marginal voltage all produce non-zero data that is not the program. The coherence check is what separates the three.
Related reading
- TMS320F28067 and what “locked” means at the controller — the comparator model behind this sequence.
- TMS320F2811 and sector-level write protection — a second, independent gate on the same array.
- TMS320F28375 and dual-zone configuration — what the sequence becomes when there are two zones.
FAQ
Why does one wrong word force a reset? Because otherwise the eight-word password could be searched by iteration. The reset is what makes each attempt expensive.
Is the dummy read of the password locations optional? No. Without it the key writes are not accepted, and the module gives no indication of that.
Does the module acknowledge a successful unlock? No. The only evidence is that previously hidden memory now reads as data.
Can the password be read out on a locked part? The locations return zeros while locked. There is nothing to read.
Is the code encrypted behind the password? No. It is stored plainly and gated by an access check. There is no cipher to attack.
Conclusion
Unlocking this part is a sequence with a precondition and a proof: read the password locations, present eight words in order, then verify by reading code that was hidden. Failures cost a reset by design, which is why the sequence is worth reading twice before running once — and why the useful measurements are the ones available outside the protected region.