ST72F32AK1 Flash Memory Protection: What the Read Actually Returns
The single most expensive misunderstanding in ST72F32AK1 flash memory protection work is the belief that a protected device stops answering. It does not. It answers, promptly and consistently, and the answer is a value. The problem is that three completely different device states produce answers that look similar, and the engineer who treats them as one state will spend a day debugging a protocol that was never broken.
This article is about those three answers. What each one means, how to tell them apart without guessing, and why the most common one is also the most misleading.
Three outcomes, only one of which is silence
When a read is attempted against a device whose protection bit is set, the interface behaviour falls into one of three patterns.
| what the tool receives | likely device state | how to confirm |
|---|---|---|
every byte reads back as FF |
protection active, array not disclosed | the vector table at the top also reads FF |
every byte reads back as 00 |
protection active on a part that returns zeros, or a bus that is not being driven | a known-good part of the same group returns real data on the same setup |
| the device accepts commands and then refuses the read | protection active with an explicit refusal path | other commands, such as status, still work |
| silence, no response at all | not a protection issue: power, clock, or wiring | the same setup reads a known-good part successfully |
The fourth row is the one that matters most, because it is the row that gets misdiagnosed as protection. A device that says nothing is not protecting anything. It is not running. Those are different problems with different remedies, and the test that separates them costs one known-good device and two minutes.
Why an all-FF read is not an empty part
An erased flash block reads FF. A protected flash also reads FF. The two are indistinguishable at the byte level, which is why “the part is blank” is such a persistent wrong conclusion.
They are distinguishable at the structural level. An erased device has an empty vector table: the sixteen words at the top of the map that hold interrupt entries are all FF, and the reset vector at the very top is FF as well. A device whose protection has just been enabled and whose code is intact also returns FF for those words through the protected interface, but it still behaves like a programmed device in every other observable way.
The cheapest discriminator is therefore not the read at all. It is whether the device runs. Put it back in a working board, or in the fixture the customer uses for functional test, and see whether the product boots. A device that boots with a blank-looking read is protected, not empty. A device that does not boot may be empty, damaged, or configured to refuse, and now the read result is actually informative rather than contradictory.
Where the protection bit lives
On this family the configuration is stored in a small number of bytes that sit immediately below the interrupt vector table, at the top of the address space. That position is not arbitrary. It places the configuration at the one region whose address does not move with capacity, so the same location holds the same information on every member of the family regardless of how much flash the part carries.
| region | position | changes with capacity | what it governs |
|---|---|---|---|
| application flash | from the start address upward | yes | code and constants |
| option bytes | immediately below the vector table | no | protection, reset behaviour, clock options |
| interrupt vector table | fixed at the top of the map | no | where each interrupt goes |
| reset vector | the last two bytes | no | where execution begins |
The consequence for planning is straightforward. Since the option bytes never move, a plan that knows the family knows exactly which two or three addresses to examine, on a 8 KB part and on a 60 KB part alike. What changes is only how far down the application region begins.
The erasure that clears everything
The protection bit is not a fuse in the sense that a one-way physical change has been made. It is a programmed value in flash, and like any programmed value in flash it can be erased. The device’s own programming interface accepts a full-chip erase regardless of the protection state, and performing that erase clears the protection bit along with everything else.
That is the mechanism behind every “unlock” claim on this family, and it is also why those claims are so often disappointing. The erase does not reveal anything. It removes the thing that was being protected. A customer who asks for an unlock and expects the firmware back is asking for two operations that are mutually exclusive: the erase that removes the protection is the same erase that removes the code. The trade-off is worked through from the customer’s side in ST72F324BJ flash memory unlocking.
| what the customer asks for | what is technically possible | what it costs |
|---|---|---|
| read the code out of a protected part | yes, by a route that does not go through the protected interface | sample is consumed |
| remove the protection so the part can be reprogrammed | yes, by full-chip erase | existing contents are gone |
| remove the protection and keep the code | no | the two are the same operation in opposite directions |
What “break protection” can and cannot mean
Given the above, the phrase break ST72F32AK1 flash memory protection has two legitimate readings and one illegitimate one.
The legitimate reading is that the protection is circumvented at the silicon level, by accessing the array through a path that does not consult the option bytes. That is a physical procedure, it consumes the sample, and it produces the contents.
The second legitimate reading is that the protection state is changed so the device can be reused, accepting the loss of contents. That is a service a programming house can perform, and it is cheap.
The illegitimate reading is that some command sequence, some voltage glitch, or some tool setting will cause the device to disclose its contents through the protected interface. It will not, because the interface is not where the decision is made. The decision is made in the array, at the address the option bytes occupy.
Reading a protected part in a way that produces usable output
When the physical route is chosen, the output quality depends almost entirely on preparation done before the package is opened. The most valuable of those preparations is establishing the vector table from an unprotected sibling or from the customer’s own programming file, because the vector table is what makes the resulting image interpretable.
With the vector table known, an image recovered from the die can be checked against it immediately: every entry should point inside the application region, and the reset vector should point at code that begins with a plausible startup sequence. Without it, the image is a byte blob with an unknown base and no way to verify that the read was complete.
For devices in this family that are not protected but are simply difficult, the ST72F321M9 classification approach is the right starting point, and the format question that follows every successful read is covered in ST72F321R9 locked memory file.
What the report should contain
A ST72F32AK1 flash memory protection report that is worth paying for states four things. Which of the three read outcomes was observed, and therefore which state the device was in. Whether the device was confirmed functional before the read was attempted. Which route was used, and what it consumed. And, if the array was recovered, the base address and the vector table used to validate it.
The first item is the one that prevents arguments later. A customer who is told “the part was protected, here is the proof, here is what it cost” understands the invoice. A customer who is told “we could not read it” will assume the attempt was incompetent, and there is no way to recover from that impression after the fact.