Atmega128 restarts

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
sir
Posts: 1
Joined: Sat May 03, 2008 6:22 pm

Atmega128 restarts

Post by sir » Sat May 03, 2008 6:37 pm

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.

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Post by christian » Sun May 04, 2008 10:23 pm

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()?

Post Reply