Page 1 of 1

Atmega128 restarts

Posted: Sat May 03, 2008 6:37 pm
by sir
Hi,

I have a problem with Atmega128 and AVR-USB. When I call usbInit() my AVR restarts.

Schematic: www.exsports.info/sch.JPG
UsbConfig: www.exsports.info/usbconfig.h
Code:

Code: Select all

int main(void)
{
   PORTD = 0;
   DDRD = 0b11111000;

   usbInit();

   sei();
   for(;;){
      usbPoll();
   }
   return 0;
}


In my board R17 and R18 (from schematic) are 100Ohm instead of 68Ohm. Fuse bits configuration is in my opinion OK (0xEF 0x99 0xFd). I'm using 12Mhz crystal.

Sorry for my English and thanks for help.

Posted: Sun May 04, 2008 10:23 pm
by christian
Have you enabled the watchdog? Please note that newer devices don't reset the watchdog during a CPU reset. Once it is enabled, it stays enabled until explicitly disabled.

usbInit() can't crash, it just initializes some registers. Maybe sei() causes the crash, an interrupt may be enabled which has no vector set.

How do you know it restarts? And how do you know it restarts when you call usbInit()?