The actual project is my own ISP firmware.
Host and Target controller are both ATmega8. Download software is AVR-Studio with STK500 protocol version 2. This protocol version is also implemented in host controller. Both controller are connted via SPI interface and communicating through serial programming instruction set.
AVR-Studio sends data page by page, 64 bytes/32 words per message. Loading program memory page into target controller is no problem and works as expected. Then, I send a "write the memory page", also no problem as long as I use a fixed page address.
I have trouble to calculated the address during flash process for each page. I'm not sure if the "write memory page" command uses word or byte addressing.
When I tried to write one page at the time to different locations I found the following page address locations:
Write Memory Page Cmd Page Addr Range in Memory in Byte 1 0x0000 0x0000-0x003F 2 0x0020 0x0040-0x007F 3 0x0040 0x0080-0x00BF 4 0x0060 0x00C0-0x00FF 5 0x0100 0x0100-0x013F 6 0x0120 0x0140-0x017F 7 0x0140 0x0180-0x01BF 8 0x0160 0x01C0-0x01FF 9 0x0200 0x0200-0x023F 10 0x0220 0x0240-0x027F
...and so on.
If I send the 16 bit address only in WORD count, then I lost 4 pages after 4 pages written.
Memory content looks like this then:
Page1Page2Page3Page4Page9Page10Page11Page12...and so on.
Page5-8 is lost because address count was 0x0080, 0x00A0, 0x00C0 and 0xE0. Which seems are no valid addresses for "write memory page" command.
So how do I calculate this address?
I would appreciate any help.