[sdiy] "AVR synthesizer"
Paul Maddox
P.Maddox at signal.QinetiQ.com
Thu Feb 17 12:47:00 CET 2005
Ingo,
> Some thoughts about user-updatable software:
> IMHO under no circumstances it should be possible that the device is
> becoming useless by an incomplete or otherwise corrupted dump.
>
> So I think it's mandatory that a new version is buffered in a different
> memory location before the only existing original version in the device
> is overwritten.
Agreed, but the MEGA16 only has 1K of RAM, as opposed to the 16K of code.
The AVRs can *only* run code that is in the program memory, not from
anywhere else.
Also, the 'boot loader' is kept at the top of the Program space and is
normally left alone, the reduces the code free to developers, but this need
only be a by 512Bytes->1Kbyte.
so, if a version fails to load or is corrupt, you can always send it again,
or a previous version, you can't 'store' both version in the space (unless
you can get them to less than half the available code memory).
Normally, you would hold down a button at power up, which would make the AVR
jump to the bootloader.
What I do is, have an area off EEPROM (first couple of bytes), and when I
enter self programming mode, I set it to 0 (or something), once I've
received all the data (including checksum), I then reset this eeprom
location to 0xFF.
So when the 'main' code starts it checks that section of EEPROM, if its got
0xFF then code runs normally, if its anything else, then the code jumps back
to the bootloader and waits to receive valid data.
Paul
More information about the Synth-diy
mailing list