Hello,
I am using an ATmega324PA in a new application and want to provide IAP capability, i.e. there is a loader that can update the application by serial communication.
The IAP loader is located at the top of the flash memory (in the RWW section), and exactly follows the description given in the data sheet and some application notes to erase and write the flash.
However, the SPM command simply does nothing - neither does ist erase a flash page, nor does it program any data into the flash. There isn't any delay when programming, either - SPMEN becomes inactive immediately again after SPM has been issued.
I have looked at several (supposed to work) code samples, and I think the accesses and their sequence is exactly identical. What could be wrong?
Here's the code (IAPBase is at word address 0x1E00):