Page 1 of 1
FIXED - mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 2:13 pm
by amx
Hello,
I have got a problem with the usbasp bootloader: it does not enumerate after plugging in the usb cable (bus powered) but only if I do another manual reset (short the mega8's reset to ground - there is a pull up on the reset-pin).
Since I have some spare boards I am happy to give(/mail) one to the first person whose comment resolves the issue.
Best regards
Re: mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 2:36 pm
by ulao
Show us your schematic, or at lease the usb side of it.
Re: mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 2:50 pm
by amx
It is a pretty standard/basic setup:
Code: Select all
PD2/INT0 --- R68 --- D+
PD3/INT1 --- R68 -+- D-
PD4 --- R1k5------|
I am using an atmega8 at 12MHz and 3.3 Volts.
As mentioned before: enumeration works but not immediately after plugging in the cable.Code: Select all
#define USB_CFG_IOPORTNAME D
#define USB_CFG_DMINUS_BIT 3
#define USB_CFG_DPLUS_BIT 2
#define USB_CFG_PULLUP_IOPORTNAME D
#define USB_CFG_PULLUP_BIT 4
I modified the main() of the usbaspbootloader slightly since I do not have a dedicated button for the bootloader (on by default)
Code: Select all
// if(bootLoaderCondition()){
uchar i = 0, j = 0;
initForUsbConnectivity();
do {
usbPoll();
#if BOOTLOADER_CAN_EXIT
if(requestBootLoaderExit){
if(--i == 0){
if(--j == 0)
break;
}
}
#endif
// }while(bootLoaderCondition()); /* main event loop */
} while(1);
// }
Re: mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 4:16 pm
by amx
Okay, I fixed it.
I had to comment out the function/macro that initializes the bootloader button.
This is how the main function looks like:
Code: Select all
int __attribute__((noreturn)) main(void)
{
/* initialize */
wdt_disable(); /* main app may have enabled watchdog */
// bootLoaderInit();
odDebugInit();
DBG1(0x00, 0, 0);
#ifndef NO_FLASH_WRITE
GICR = (1 << IVCE); /* enable change of interrupt vectors */
GICR = (1 << IVSEL); /* move interrupts to boot flash section */
#endif
// if(bootLoaderCondition()){
uchar i = 0, j = 0;
initForUsbConnectivity();
do {
usbPoll();
#if BOOTLOADER_CAN_EXIT
if(requestBootLoaderExit){
if(--i == 0){
if(--j == 0)
break;
}
}
#endif
// }while(bootLoaderCondition()); /* main event loop */
} while(1);
// }
leaveBootloader();
}
Thanks!
Re: FIXED - mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 4:59 pm
by ulao
"I had to comment out the function/macro that initializes the bootloader button."
LOL
Yeah... The boot loader is designed to work one "button" is pressed. I overlooked that part
, good thing you got it, always better to learn it yourself.
Re: FIXED - mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 8:00 pm
by amx
Yeah, now it works.
ulao, since you were the only one who replied, if you want a board pm me a mail address.
Re: FIXED - mega8 only enumerates after manual reset (PRIZE)
Posted: Fri Jan 04, 2013 9:12 pm
by ulao
Oh thx so much for the offer but that wont be necessary. I dont think this forum has a pm anyways. I'm just happy to help.
Re: FIXED - mega8 only enumerates after manual reset (PRIZE)
Posted: Sat Apr 13, 2013 10:57 am
by vouvoume
Hi
Classic ATmega8 is designed for 5V. So 3.3V may be not safe?
If you are still interested, maybe take a look into a recent fork of USBaspLoader:
https://github.com/baerwolf/USBaspLoaderThis version has a revised bootloader condition.
Best regards