tiny84 self programming time

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi all,

I am working on a USB bootloader using usbtiny-1.3. It works like a charm with a mega88. But when I use a tiny84 ,the USB request seems to time out, even if I only do the page erase, and nothing else. The first page gets written, I've verified that.

The algorithm is pretty much copied from the avr-libc documentation (see below), and according to the datasheets the two devices have basically identical behaviour for self programming. Both run off a 12MHz crystal and use the internal oscillator for flash programming timing.

Using avr-gcc 4.1.1 on Linux (compiled with the script in the sticky section).

Does anybody have an idea what is going wrong?

Thanks,
Markus

   eeprom_busy_wait();

    uint16_t baseAddr = wAddr_;
    cli();
    boot_page_erase( baseAddr);
    sei();
    boot_spm_busy_wait();

    cli();
    for ( ; value; value -= 2, wAddr_ += 2, pb_ += 2) {
      uint16_t w = pb_[0];
      w += pb_[1] << 8;

      boot_page_fill( wAddr_, w);
    }

    boot_page_write( baseAddr);
    sei();
    boot_spm_busy_wait();
#ifndef __AVR_ATtinyX4__
    boot_rww_enable ();
#endif