ATxmega128A3 Code Reading: What the Locks Actually Do

Nine out of ten enquiries about a locked ATxmega128A3 describe the device as protected without qualification. On this family that word covers at least three different situations, and only one of them actually prevents the array from being read.

One Byte, Four Fields

The lock state on XMEGA A devices lives in a single byte at offset +0x07 in the fuse area. It ships erased, which means every field reads as one. The byte is divided into four fields, each two positions wide: the boot loader section lock, the application section lock, the application table section lock, and the global lock.

The first three govern what software can do to the flash sections from software: a program running in the application area reading the boot loader, or a boot loader reading the application area. They do not govern the programming interface at all. That is the job of the fourth field, and it is the one that decides whether an outside reader gets anything back.

The Three States That Matter

The global field has four encodings and three meanings.

Value Name Effect Array readable from outside
11 no lock nothing blocked yes
10 write lock writes through the programming interface disabled; fuses locked against writing yes
01 not used undefined not used
00 read and write lock writes and read or verification disabled; locks and fuses also closed to reading no

Read the middle row twice, because it is where most of the confusion originates. A device at 10 cannot be reprogrammed through the programming interface, and the fuse area can no longer be altered. Nothing in that state stops a reader from pulling the array out and comparing it byte for byte.

This is not a documented loophole. It is the intended meaning of the encoding, and it exists because a write lock has a legitimate use: it prevents a field update from overwriting a boot loader while leaving inspection possible for service. But it does mean that a production line which programmed 10 and reported the part as protected has, in fact, left the firmware readable.

What the Section Locks Do

The application section field and the boot section field are frequently mistaken for the same thing as the global lock. They are not. They restrict what software can reach across sections, so an application at read lock cannot read the boot loader, and a boot loader at read lock cannot read the application. Neither affects a reader connected to the programming interface.

A device can therefore be locked in the section sense and completely open in the global sense. Customers who have “locked the boot loader” to stop a competitor from reading it have usually set the section field, and the array is still fully readable.

Only the global field closes the outside door, and only at 00.

What a Chip Erase Does to All of This

The lock fields cannot be relaxed, only tightened. The single way to reset them is a chip erase, and the locks are cleared after the rest of the array has been erased, which is why a full erase is also the documented way to reuse a locked part.

Two consequences follow. A part that has been erased is unlocked and blank, so an erased device tells you nothing about what it used to contain. And a part still in service cannot be un-locked in place, so any attempt to “remove the protection” destroys the very data the customer wanted.

The erase also touches EEPROM depending on how the EESAVE fuse was programmed. That one setting decides whether retained parameters survive an erase, and it is worth reading before anyone experiments on a production board.

How the State Is Established Before a Quote

Reading the lock byte requires the programming interface to still answer, which it does at 11 and 10. At 00 the interface refuses to return anything, and the state has to be inferred from behaviour: an identification read that succeeds while the array read fails is the signature of a 00 part.

That distinction drives the whole plan. A part at 10 is a bench read with a known schedule. A part at 00 is a laboratory job that starts with opening the package. Quoting one as the other is the most common commercial mistake in this work, and it is avoidable in about ten minutes of probing.

Where the Array Comes From When the Interface Is Closed

The optical route: remove the package, expose the array, image the cells. A 64-lead thin quad flat package is a reasonable target, and the semi-invasive method is usually enough because it leaves the metal layers intact. The invasive route is reserved for parts where the array cannot be reached from the front.

The protection levels guide sets out how each state is recognised from the outside, and the cost breakdown explains which factors move a quote, which is rarely the density and usually the package.

What to Send

The top marking, the package, the board function and the quantity, plus a note on whether the part is still in a working board or has been removed. If the device still responds to an identification request, say so: that single fact separates a bench job from a laboratory job, and it is the first thing the engineering desk will ask.

Service scope and next steps

Atmel and Microchip AVR devices are read regularly, including fuse and lock-bit protected parts where the flash contents are still retrievable. We check the fuse state and lock bits before quoting. The full scope of what we handle, how a project runs from electrical integrity test to delivered file, and the payment terms are described on our service capabilities page.

Need an AVR or ATmega part read?

Send us the part number and a short description of what you need. Free evaluation, fixed quotation, and a reply within one business day.

Request a quotation

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *