ATxmega64A1 Heximal Reading: 256 Pages of 256 Bytes

Written by

in

The smallest member of the XMEGA A1 family is the only one that does not use half-kilobyte pages. That one difference decides whether a recovery produces a working image or a file that looks perfectly reasonable and will not run.

What the Array Actually Contains

An ATxmega64A1 carries 64 KB of application flash plus a 4 KB boot loader section. The application area is divided into 256 pages, and each page holds 128 sixteen-bit words, which is 256 bytes. The boot loader is 16 pages of the same size. Data EEPROM is 2 KB in 64 pages of 32 bytes, and SRAM is 4 KB.

Put that beside the rest of the line, as the 128A1 page does for the half-kilobyte parts, and the outlier is obvious. Every other density in the A1 family uses 256-word pages, so each page is 512 bytes: the 128A1 has 256 pages, the 192A1 has 384, the 256A1 has 512 and the 384A1 has 768. Only the 64 KB part halves the page and doubles the page count for its size.

Why the Page Split Is Not a Detail

Flash on these devices is addressed through the Z pointer. The high part of the address selects the page and the low part selects the word inside it. On a 512-byte page the word field occupies Z[8:1] and the page field Z[17:9]. On the 64A1 the word field is Z[7:1] and the page field Z[16:8], because there are half as many words to walk through.

A capture routine written against the 128A1 keeps using its own split. It fetches a page, advances the page counter and fetches again, and every second fetch lands halfway into the next page. The result is a file where each 512-byte chunk contains the back half of one page followed by the front half of the next. The data is all present and every byte came off the chip correctly. The order is wrong.

The symptoms are consistent enough to recognise. A checksum taken over the whole array fails even though two reads of the same part agree with each other. Disassembly shows long stretches that almost decode: jumps that land in the middle of an instruction, string tables that survive intact with broken code between them, and interrupt handlers that begin three bytes late. Engineers often read that as a protection problem and start asking about decapsulation when the real fault is an address split two revisions out of date.

Catching It Before Delivery

Three cheap checks close the question.

– The first two bytes of a valid XMEGA image are 0C 94, the encoding of a jump placed at address zero. If the image starts with anything else, the start offset is wrong. – The application area of a 64A1 ends at 0x0FFFF and the boot loader runs to 0x10FFF. Any content beyond that address did not come from this device, whatever the reader reported. – Read the part twice with different page strides. A page-size error shows up as a fixed 256-byte shift that repeats at every page boundary, not as random corruption.

What Travels With the Code

The application area is only part of what a customer needs. A complete delivery also carries the 4 KB boot loader, the 2 KB of EEPROM over its 64 pages, the fuse and lock state, and the user signature row.

That last item is easy to forget and occasionally matters more than the code. The user signature row is one flash page, so 256 bytes here rather than the 512 used on the larger parts, and it is deliberately excluded from a chip erase. A part pulled from a scrapped board can therefore still hold the previous owner’s serial number, calibration constants or a seed value, and a replacement built without copying it will behave differently from the original in ways that are hard to trace.

Read-out protection is a separate subject from page arithmetic. If the part was shipped with the lock fields programmed, no reader will return the array in the first place, and the work moves to the optical route. The protection levels guide explains how to tell which state a device is in before a quote is issued, and the copy protection overview covers what each state means for the owner of the design.

Why the Small Part Attracts This Mistake

Density is chosen by the application, not by the lab. A product that needs 60 KB of code lands on the 64A1, and it is frequently a volume item where the firmware was written years ago and the toolchain was configured once for a larger evaluation board. When the same customer later sends a 128A1 from a different product, the earlier success becomes the template for the wrong plan.

The other reason is that 64 KB sounds like a small job. It is a small job, but it is not a simpler one, and the page arithmetic is the reason. Reading a 64 KB array correctly takes the same care as reading 384 KB.

Ordering the Job

Send the full top marking, the board function and the number of units involved. If a second part from the same product line is available, mention it, because a paired read is the fastest way to confirm page size and vector placement. The reading service covers the capture stage, and our engineers will confirm from the marking whether the device is the 256-byte or 512-byte variant before any work is scheduled.

Service scope and next steps

The first step on an AVR target is reading the fuse and lock byte configuration, since that tells us how the flash is protected and what is technically possible. 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.

Ready to extract this AVR firmware?

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