MikeB wrote:If the processor is changed, it might be worth checking out the M2561. I think it is still pin compatible, but has 256K flash and 8k bytes RAM (4k bytes EEPROM).
It also has more internal functions, but is still only 16MHz.
I just had a look. The 2561 would be a candidate indeed in terms of compatibility, however it's 4 times more expensive, at approx $20 vs $5 for a mega64 or mega128. Less interesting IMO, as the additional capabilities would require further development. The mega128 should be a good compromise, it's cheap and removes the most annoying limitations (small model memory and limited flash) with a minimal amount of work.
MikeB wrote:The Atmel instruction set only directly supports 64K flash. To handle 128K some instructions have to be different
Regarding this I had a look, and couldn't find the relevant info. There seems to be no restriction regarding flash.
There is such an issue, but it concerns the I/O memory:
The ATmega128 is a highly complex microcontroller where the number of I/O locations supersedes
the 64 I/O locations reserved in the AVR instruction set. To ensure backward compatibility
with the ATmega103, all I/O locations present in ATmega103 have the same location in
ATmega128. Most additional I/O locations are added in an Extended I/O space starting from $60
to $FF, (i.e., in the ATmega103 internal RAM space). These locations can be reached by using
LD/LDS/LDD and ST/STS/STD instructions only, not by using IN and OUT instructions.
But it's already like this on the mega64.
According to
this document by atmel, the only significative difference between the mega64 and mega128 is an ADC feature that is not used in the 9x firmwares:
The start of an ADC conversion in Atmega64 can auto trigger on interrupt sources.
This ADC auto triggering is not implemented in Atmega128.