ATxmega192A1 Code Extraction: The 2 KB EEPROM Trap

Three assumptions arrive with almost every ATxmega192A1 enquiry. That 192 KB is a round number in this family, that a part with 16 KB of RAM will also carry the larger EEPROM, and that a plan proven on the 128A1 or the 256A1 will transfer without change. All three are wrong, and the third one is expensive.

1. The Array Is 384 Pages, Not 300

192 KB divides into 384 pages of 512 bytes. The number looks arbitrary because it is: the density grew by adding pages rather than by enlarging them. The page size stays at 256 words, the same as every A1 part above 64 KB, so the addressing split inside the Z pointer is unchanged and a reader tuned for the 128A1 will walk this array correctly.

What changes is the count. Three hundred and eighty-four pages is one and a half times the 128A1 and three quarters of the 256A1. In practice this matters for the capture plan rather than the electrical work: page counters, progress estimates and checksum tables built around a power-of-two page count all need adjusting, and a tool that silently stops at 256 pages will return a 128 KB file from a 192 KB part without raising an error.

That failure is quiet and easy to miss, because a truncated image looks like a complete one. The check is arithmetic: the last application address on this device is 0x2FFFF, the boot loader occupies 0x30000 to 0x31FFF, and an image that stops at 0x1FFFF came from a reader that gave up early.

2. Sixteen Kilobytes of RAM, Two of EEPROM

Here is the part of the specification that catches people. The 192A1 carries 16 KB of SRAM, which is the same as the 256A1 and double the 128A1. Its data EEPROM, however, is 2 KB across 64 pages of 32 bytes, which is the same as the 128A1 and half of the 256A1.

So the device is asymmetrical relative to both of its neighbours. Copy the memory plan from the 256A1 and you will reserve 128 EEPROM pages and read 64 of them as valid data. Copy it from the 128A1 and you will get the EEPROM right while underestimating what the firmware can hold in RAM, which matters when you are deciding whether a recovered image can be recompiled for a smaller substitute.

There is a practical consequence beyond bookkeeping. Products that store calibration, meter totals or a cycle counter in EEPROM are exactly the products that end up in a recovery queue, and on this device that store is small. If a customer expects four kilobytes of retained parameters because the part number suggested a bigger machine, the expectation needs correcting before the work starts rather than after the file is delivered.

3. Identification Shares a Middle Byte

The 192A1 answers to 1E 97 4E. The 128A1 answers to 1E 97 4C. The vendor code and the density code are identical, and only the third field separates them. Any reader, script or inventory sheet that records two bytes will report a 192 KB device as a 128 KB device, and the resulting quote will be wrong in both directions: too low for the read, too high for what the customer thinks they are getting.

Recording all three fields and comparing the pattern, rather than the capacity-looking byte, removes the ambiguity. It is a small discipline that saves a rescheduled job.

4. What a Complete Image Contains

Application array as a single file, the 8 KB boot loader as a second, the 2 KB of EEPROM as a third, and a written record of the fuse and lock state. The fuse state is not decorative: it records whether the EEPROM survives a chip erase and whether the reset pin still behaves as a reset pin, and a replacement device built without that record will not match the original board.

It is also worth capturing the user signature row. It is one page of flash, excluded from a chip erase by design, and on a second-hand part it can carry the previous owner’s serial or calibration data. Recovering it costs nothing during a capture and cannot be reconstructed afterwards.

5. When the Lock Fields Are Set

If the device shipped with its lock fields programmed, none of the above is reachable through the programming interface, and the work moves to decapsulation and optical reading. That is a different schedule and a different budget. The protection levels guide explains how to tell the states apart from the outside, and the cost breakdown shows which factors actually move a quote, since page count is rarely one of them.

Flash behaves differently from the older one-time-programmable parts in this respect, and the memory technology comparison is a useful primer for anyone whose previous recovery experience was on an OTP device where nothing could be erased and everything depended on the fuse state at the factory.

Practical Summary

Treat the 192A1 as its own machine rather than as a scaled version of its neighbours. Expect 384 pages of 512 bytes, 2 KB of EEPROM over 64 pages, 16 KB of RAM, and an identification pattern that shares its middle byte with a smaller part. Build the capture plan from those numbers, verify the last address, and record the fuse state.

The reading service describes the standard capture and verification steps, and the engineering desk can confirm densities against the top marking before a job is booked.