ATTiny84 self-programming seems to wedge V-USB
Posted: 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:
This is a bit frustrating, any help would be appreciated.
-Curt
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