General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
			
		
		
			- 
				
																			 amx
- Posts: 6
- Joined: Fri Jan 04, 2013 2:00 pm
						
						
													
							
						
									
						Post
					
								by amx » Fri Jan 04, 2013 2:13 pm
			
			
			
			
			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
					Last edited by 
amx on Fri Jan 04, 2013 4:16 pm, edited 2 times in total.
									
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 ulao
- Rank 4
  
- Posts: 481
- Joined: Mon Aug 25, 2008 8:45 pm
						
						
													
							
						
									
						Post
					
								by ulao » Fri Jan 04, 2013 2:36 pm
			
			
			
			
			Show us your schematic, or at lease the usb side of it.
			
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 amx
- Posts: 6
- Joined: Fri Jan 04, 2013 2:00 pm
						
						
													
							
						
									
						Post
					
								by amx » Fri Jan 04, 2013 2:50 pm
			
			
			
			
			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);
//  }
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 amx
- Posts: 6
- Joined: Fri Jan 04, 2013 2:00 pm
						
						
													
							
						
									
						Post
					
								by amx » Fri Jan 04, 2013 4:16 pm
			
			
			
			
			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!
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 ulao
- Rank 4
  
- Posts: 481
- Joined: Mon Aug 25, 2008 8:45 pm
						
						
													
							
						
									
						Post
					
								by ulao » Fri Jan 04, 2013 4:59 pm
			
			
			
			
			"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.
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 amx
- Posts: 6
- Joined: Fri Jan 04, 2013 2:00 pm
						
						
													
							
						
									
						Post
					
								by amx » Fri Jan 04, 2013 8:00 pm
			
			
			
			
			Yeah, now it works. 

ulao, since you were the only one who replied, if you want a board pm me a mail address.
 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 ulao
- Rank 4
  
- Posts: 481
- Joined: Mon Aug 25, 2008 8:45 pm
						
						
													
							
						
									
						Post
					
								by ulao » Fri Jan 04, 2013 9:12 pm
			
			
			
			
			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.
			
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			 vouvoume
						
						
													
							
						
									
						Post
					
								by vouvoume » Sat Apr 13, 2013 10:57 am
			
			
			
			
			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