I am updating my bootloader-programmer to handle the Leonardo which has a Atmega32U4 processor.
According to the datasheet the flash page size is 128 words (therefore 256 bytes) however when uploading with that as the page size I get multiple errors.
Changing to 128 byte page size the bootloader uploads without errors. However that is not consistent with the datasheet.
Has anyone found anything along these lines before? Is the documentation wrong? The page size documented for the Atmega328P is 64 words (128 bytes) and the bootloader-programmer has been working fine in the past using that figure.
The iom32u4.h file has SPM_PAGESIZE as (128), which is also used in the caterina bootloader (although it isn't immediately obvious in the bootloader whether it's using it as a byte count or word count.) iom328p.h also has SPM_PAGESIZE as 128...
So that strongly supports the idea that the page size is 128 bytes. So the datasheet must be wrong? I got the latest one from Atmel and it still says 128 words.
The responses were pretty dismissive, however I don't believe that it was ever resolved properly. The OP just said it worked (for reasons he couldn't understand) if he disregarded the datasheet and used a page size of 128 bytes.
I managed to put in a support request so we'll see what happens.
Maybe I'll get the same treatment on the AVR Freaks forum that the other guy did, that they just said he didn't understand the difference between bytes and words.
A pretty hard mistake to make when you are writing code that programs chips successfully.
Hello all, I just take a chance to clear up words a bit.
Actually, checking on Wikipedia, which I did when reading on the Atmel datasheet, a word is a generic number and it has the width of the system it is referred to.
So, in a 8-bit system, a word is actually a byte, while it goes up in larger systems according to their architecture.
I suggest everyone including me to clear up completely every word in a sentence when it doesn't make sense, because the answer is most of the time in words incorrectly defined, or incorrect definition applied, and this single fact opens up to higher speed in general understanding.