STM32F101RB: When the Part Number and the Silicon Disagree
An extraction plan usually starts from the part number. The number tells you the flash size, the package, the peripheral set, and by extension which protection mechanisms to expect. On this family that assumption is worth checking before it is built on, because the access line and the performance line are the same design, separated by testing rather than by architecture.
That does not make the part number wrong. It makes it a statement about what was guaranteed to the customer, which is not the same as a statement about what is on the die.
One design, two product lines
The two lines share the core, the memory interface, the debug architecture and the protection mechanism. They differ in the maximum clock the vendor will guarantee, in which peripherals are bonded out and documented, and in price. A die that passes the higher speed test is sold as one product; a die that passes the lower test is sold as the other.
The practical consequences for extraction work:
- the protection mechanism behaves identically, so the procedure does not change,
- the flash geometry is the same for a given density, so the memory map does not change,
- the die identification register may be identical, so it does not by itself tell you the line,
- the clock ceiling differs, which matters when you write code that has to run on the device.
| Question | Answer that comes from the register | Answer that comes from the label |
|---|---|---|
| Die family | Yes | Usually |
| Flash density | Yes, usually | Yes |
| Maximum guaranteed clock | No | Yes |
| Which peripherals are bonded | No | Yes |
| Protection state | Separate register, not the ID | No |
Reading the identity before planning
The device exposes two useful pieces of information early, before any protection question arises: the identifier of the die, and the flash size code. Both are readable through the debug interface on an unprotected device and, on a protected one, are among the small set of things that still answer.
Reading them first is not bureaucracy. A plan built around 128 KB of flash on a device that actually has 64 KB wastes time on a memory map that does not exist, and a plan that assumes the higher clock can produce code that fails on the lower-binned part at temperature.
Why the protection mechanism is the real subject
The family uses a readout protection scheme with three levels, and the middle level is where nearly every real case sits.
Level zero is unprotected. Level one blocks the debug interface from reading the array and, importantly, also blocks execution from RAM in a way that closes the obvious injection route. Level two is permanent: the debug interface is disabled for the life of the die, and there is no documented path back.
The asymmetry that defines the work is this. Going from level one to level zero is possible, and it erases the array as part of the transition. The device therefore offers a way to remove the protection and no way to keep the contents while doing so.
What level one actually blocks
It is worth being precise, because the imprecision causes wasted effort.
Under level one the array cannot be read through the debug port, and a program running from RAM cannot be used to read it either. What still works is the program that is already in flash: it executes normally, reaches its peripherals, and behaves exactly as it did in the product. The device is protected against inspection, not against operation.
That asymmetry is the whole attack surface. Anything the original program can do with its own data, it will still do. If the design includes an in-application programming path, a serial bootloader, a diagnostic protocol, or a calibration export, those paths still function and still move data out of the device — because they were written to move data out of the device.
Finding an export path
The productive question is therefore not how to read the array, but whether the product already reads it.
- Identify every external interface the design uses, from the board rather than from the datasheet.
- Capture traffic on each during startup, during normal operation, and during any service sequence.
- Look for a frame that carries more data than the function requires, especially anything with an address field.
- Check whether a firmware update path exists; where there is an update path there is usually a readback or a verify command.
- Test the service sequence on a working unit before touching the locked one.
Step four is the one that pays. Update protocols need to confirm what they wrote, and confirmation usually means reading back. A verify command that returns data is a read command with a different name.
When there is no export path
Then the remaining options are the ones that do not go through the device’s own software: physical access to the die, or a fault approach that changes what the protection logic permits. Both are expensive, both are outside what a bench session can do, and both should be scoped as separate projects rather than as extensions of a debug session.
The honest statement to a customer at that point is that the protection is doing what it was designed to do. This is not a device with a flaw; it is a device with a working feature.
The duplicate case
A frequent request is not extraction at all, but duplication of a device the customer already owns and can read. In that case the level-one problem disappears and a different one appears: the destination device must be programmed and then protected, in that order, and the protection transition must not be attempted before the program is verified.
Programming a level-one device requires returning it to level zero first, which erases it. A production flow that protects each unit immediately after programming is correct. A flow that protects first and programs later does not work, and the failure looks like a device that refuses every write.
Related reading
- STM32F101C4 and what changes on a small array — same mechanism, different consequences.
- STM32F101CB and preparing a destination device — the duplication order in detail.
- STM32F103CB and verifying that a dump is real — what to check before believing an image.
FAQ
Does the identifier register tell me which product line I have? Usually not. Both lines can report the same die identifier.
Can level one be removed without erasing? Not through any documented path. The transition erases.
Does level one stop the program from running? No. It stops inspection. The program runs normally.
Is level two recoverable? No. The debug interface is disabled permanently.
Conclusion
On this family the label describes what was sold and the register describes what is there. Read the identity first, expect the middle protection level to be the real case, and look for the program’s own data paths before concluding that the array has to be attacked directly. Most successful recoveries on a level-one device go through a feature the design already had.