Copying an ATxmega128A1 Program: Identify It First

Most enquiries that reach a lab with a part number attached are accurate. The ones that go wrong are usually the ones where two densities of the same family were confused, and in the XMEGA A1 line the pair most often confused is the 128A1 and the 192A1.

The Number That Never Changes

Every device in this family answers with three identification bytes, and the first one is always 0x1E, the vendor code for the original Atmel range. That byte tells you the part is an AVR and nothing more, so it is worth checking and then ignoring.

The interesting bytes are the other two. On a 128A1 they read 0x97 and 0x4C, which combine to 1E 97 4C. On a 192A1 they read 0x97 and 0x4E, which combine to 1E 97 4E. Both parts share the middle byte. A reader that logs only two bytes, or a spreadsheet that keeps the vendor code and the density code but drops the third field, cannot tell these two devices apart.

What the Family Looks Like Side by Side

Device Application Pages EEPROM SRAM Identification
ATxmega64A1 64 KB 256 2 KB 4 KB 1E 96 4E
ATxmega128A1 128 KB 256 2 KB 8 KB 1E 97 4C
ATxmega192A1 192 KB 384 2 KB 16 KB 1E 97 4E
ATxmega256A1 256 KB 512 4 KB 16 KB 1E 98 46
ATxmega384A1 384 KB 768 4 KB 32 KB not published

Note how little the density code tells you on its own, and see the 192A1 page for the part where the middle field is the only one that changes. The 64A1 and the 128A1 differ in the middle byte, but the 128A1 and 192A1 do not, and the 256A1 changes both. Reading the identification correctly means reading all three fields and comparing the whole pattern, not picking the byte that looks like a capacity.

What 128 KB Divides Into

The 128A1 holds 128 KB of application flash and an 8 KB boot loader, and both are organised in 512-byte pages. That gives 256 application pages and 16 boot pages. Data EEPROM is 2 KB across 64 pages of 32 bytes. SRAM is 8 KB.

The 512-byte page is the family norm, which is why the 128A1 tends to become the default when a lab writes a routine for the A1 line. That default is exactly what makes the smaller 64A1 go wrong, since it alone uses 256-byte pages, and it is the reason a plan copied from a 128A1 job should never be reused without re-checking page size.

Why This Part Becomes the Baseline

The 128A1 sits in the middle of the range: enough flash for a graphical interface, enough SRAM for a display buffer, and 78 general-purpose pins on a 100-lead package. Plenty of industrial controllers, metering boards and older medical instruments were designed around it, and a good number of those designs are now old enough that the source code has been lost while the hardware is still in service.

That combination, a widely used part with a lost source and a long service life, is the ordinary reason a program copy is requested. It is rarely an attempt to clone a competitor’s product, and a credible lab will ask about ownership before anything else.

What a Copy Job Should Return

A copy is not a single file. For this device the useful delivery is the application array as one image, the 8 KB boot loader as a second image, the 2 KB of EEPROM as a third, and a short note recording the fuse and lock state plus the contents of the user signature row. Keeping them separate matters because they are erased and written by different commands and because a customer often wants to modify the boot loader without touching the application.

Verification belongs in the delivery as well. Two independent reads compared byte for byte, and a checksum quoted for each of the three images, let the customer confirm that what arrived is what left the device.

Where the device has been locked, the copy cannot be made through the programming interface at all and the job moves to another method entirely. The protection levels guide sets out how each state is recognised, and the copy protection overview explains what a lock actually prevents, which is less than most people assume.

What to Send With the Enquiry

The full top marking including the date code, the package type, the board function and the quantity. If the board carries several similar devices, photograph the whole area rather than one part in isolation, because the surrounding circuitry often explains why a particular density was chosen.

An NDA is signed before any file changes hands, and the standard terms are published on the non-disclosure agreement page. Once that is in place, the engineering desk will confirm the identification against the marking, which takes minutes and prevents the entire class of problem described above.