ATTiny84 self-programming seems to wedge V-USB

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
curtavr
Posts: 2
Joined: Mon Jul 15, 2013 8:54 pm

ATTiny84 self-programming seems to wedge V-USB

Post by curtavr » Mon Jul 15, 2013 9:07 pm

Using a Tiny84 with a 12mhz crystal clock (to free up the other B port line) D+ on INT0 and D- on the remaining non-RESET pin.

V-USB works just fine, I am faking a HID on a Win7 platform. I can move data back and forth without any issues, problem comes when I try and program the Flash. After executing boot_page_write( ... ); USB just goes away, instantly, windows reports error 31:ERROR_GEN_FAILURE. A re-start of my windows-side loading app reports the device still there however, and will re-attempt upload.

I am not posting here first, let me tell you what it's not:

- I am programming well outside the executable area, the app is located at 0x0000, I am attempting to load code at page 0x0A00
- I have confirmed that the data IS written correctly, the chip is still alive, and in fact if I re-start the code upload it again loads the first page and dies, so V-USB recovers after whatever happens
- I have verified that the "recovery" is NOT the chip resetting itself.
- I can execute every part of my loader except the actual boot_page_write(...) command
- if I execute a boot_page_write(...) command on a loop, V-USB never communicates properly, ie:

Code: Select all


   for(;;)
   {
      usbPoll();

      // just run interference
      int j;
      for( j=32; j<34; j++ )
      {
         for( i=0; i<64; i+=2 )
         {
            boot_page_fill( i + j*64, i + j*64 );
         }
         boot_page_erase( j*64 );
         boot_spm_busy_wait();
         boot_page_write( j*64 ); // comment out ONLY THIS LINE and V-USB works, otherwise it never even enumerates
         boot_spm_busy_wait();
      }
   }



This is a bit frustrating, any help would be appreciated.

-Curt
Last edited by curtavr on Mon Jul 15, 2013 9:23 pm, edited 1 time in total.

curtavr
Posts: 2
Joined: Mon Jul 15, 2013 8:54 pm

Re: ATTin84 self-programming seems to wedge V-USB

Post by curtavr » Mon Jul 15, 2013 9:15 pm

Update: If I ignore the general error 31 and continue as if it suceeded.. apparently it works, I uploaded the code and it checks out.

I am using a version of this bootloader with an Atmega88 and it does not have the error problem, sure would be nice to know what is going on, I don't mind it working but this kind of out-of-spec unknown makes me powerful nervous.

Post Reply