Enhancement #1079

Network Programming Support

Added by Kevin Woo about 14 years ago. Updated about 14 years ago.

Target version:
Start date:
Due date:
% Done:



Flesh out a system for network programming of tools. Perhaps look into how the Colony bootloader works as well as what the ATTiny2313 documentation says on bootloading or writing to program flash.


#1 Updated by Kevin Woo about 14 years ago

We need to use the Self-Programming Flash feature of the ATTIny2313. Page 155 of the datasheet.

Notes from the datasheet:

  • Need to make sure the SELFPRGEN fuse is set
  • Write to the flash 1 page at a time
    1. Fill temp page buffer
    2. Erase the page to write (Page Erase)
    3. Write the buffer to the page (Page Write)
  • Erasing a page
    1. Set page address in the Z-pointer (ZH + ZL, Z[15:0])
    2. Write 0x03 to SPMCSR and immediately execute SPM ASM instruction
  • Writing a temp page
    1. Set up address in Z-pointer
    2. Put data in R1:R0
    3. Write 0x01 to SPMCSR and execute SPM ASM instruction
  • Do not do any EEPROM writes as it will erase the temp page
  • Writing a page
    1. Set up the page address in Z-pointer
    2. Write 0x5 in SPMCSR and execute SPM ASM instruction
  • Must be page aligned address
  • Will pull the data from the temp buffer
    Notes about setting fuses:

This page describes how to set/read the fuses through AVRDUDE pretty clearly. We have to convert them to hex ourselves.

Note that the self-program enable fuse is located in the efuse section, not fuseh or fusel as all the standard fuses.

#2 Updated by Kevin Woo about 14 years ago

AVR-LIBC seems to have some macros to make this easier:

#3 Updated by Kevin Woo about 14 years ago

512byte boot loader. We can probably modify this. It's setup to use the uart protocol I believe. Need to login to avrfreaks to see it though.

#4 Updated by Kevin Woo about 14 years ago

  • Status changed from Assigned to Fixed

Network programming is implemented and works.

Also available in: Atom PDF