strange reset

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi freaks,

I've made a webserver using the enc28j60 and atmega128. The webpages and pictures are stored on a SD card using FAT32.
It was running well for about a month. Now it start's
resetting randomly.
I didn't enable the watchdog.
When it starts resetting it keeps resetting until I toggle the power manually.

Any suggestions how to tackle this problem?

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Not much info. Post a picture, schematic ... code ?

A toggle of the power solving the issue for a month ---> 98% chance it's software related. Stack ??

A toggle of the power solving the issue for a short while: likely hardware related.

Use of watchdog and brownout in a webserver application is IMO a must.

Nard

A GIF is worth a thousend words   They are called Rosa, Sylvia, Tessa and Tina, You can find them https://www.linuxmint.com/

Dragon broken ? http://aplomb.nl/TechStuff/Dragon/Dragon.html for how-to-fix tips

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I bet its a stack overflow. The imagecraft compiler has a 'StackCheck()' function that can be sprinkled around the program, but if it finds a stackoverflow, the default handler that is called just jumps to 0 to restart. (I have a handler that hangs in a loop and says STACK OVERFLOW!.... more informative than just a reset). Sometimes a stackoverflow lands you up after the end of the program in the erased flash full of 0xffff, which is some sort of a load instruction, so it executes off the end of flash and bango... back at the beginning at 0x000... which is exactly what you are observing. Make stack bigger and/or turn on stack checking. (The question was asked recently about what a good 'fill tail end of flash with this word' candidate would be... in the hc11 you could do a software interrupt that landed you in a handler for such things. But stupid Motorola dropped that processor for some reason). Is there an Atmel AVR suggestion box link somewhere? A sw interrupt would be a good feature to add, you think?

Imagecraft compiler user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If a reset have occured you might find what caused it by checking if any flags are set in MCUCSR register. Stack overflow does not set any flags in this register since this does not produce a "real" reset(just end up at 0x000 after some random code execution).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks for your replies.
I think the problem was the power supply, but won't know for sure until next month.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Run it from a battery. No ripple on those.

Imagecraft compiler user