Permanently restart of microcontroller (by call of sleep?)

AV
 
Avatar
 
Subject:

Permanently restart of microcontroller (by call of sleep?)

 · 
Posted: 20.11.2012 - 12:26  ·  #1
Hi,

I'm a new AVRco user and work with it for a few days now.
Unfortunately I have/had much trouble. (e.g. "Programmer not found" error although it's connected and worked fine on the day before.)

Well, this topic is about a restart problem.

I use AVRco (5.04.15) professional with the ISP3-USB programmer.
My hardware target is an Atmel 90CAN128.

My task is to re-write and extend an existing application.
The old application can be flashed and works fine.
So the general hardware configuration should be correct.


Problem describtion

The problems happen with my new application.
When I flash and run it, then a restart happens periodically after about 1 second.
This behaviour I see by my power LED (will be enabled at application start). Also in the debugger I see that the breakpoint of the first line (of main section) is reached periodically.
There seems to be no specific position in my code, where the restart happens. Sometimes here, sometimes there.

My first idea: The watchdog.
I commented it out. Nothing happens.
Even after removing the Watchdog unig from "import" had no different result.
So I think the watchdog wasn't the reason. (Nethertheless I keep it disabled now.)

My second idea: Any reset command.
There was one System_reset command, which was never reached.
To be shure, I commented out.

Later I disabled multithreading (by commenting out the "Start_processes" command).
No changes.

... some more tests later ...

Ok, now I recognised an interesting behaviour:
When I comment out both sleep(self, 100) (1 second) calls of my application, then it seems to work fine.

When I comment out only 1 (of 2) sleep calls, then the restarts are random.
In other words: When I start the processor, there is a random number of restarts and a few times later, the restarts stops. Sometimes (after processor start) there is even no restart.

When I enable both sleep calls in my code, the restarts always happens.


My application will use multithreading.
So I followed the manual, which propose to use sleep() instead of mDelay() or uDelay().
Additionally I created an IdleProcess (as proposed in the manual) to avoid deadlocks.


Has somebody an idea why sleep() causes that trouble?
Note: The restarts even happens without watchdog.
mc-electronic
Benutzer
Avatar
Gender: n/a
Location: Sauerland NRW
Posts: 372
Registered: 03 / 2008
Subject:

Re: Permanently restart of microcontroller (by call of sleep?)

 · 
Posted: 20.11.2012 - 14:10  ·  #2
Hello AV,

without the source code it is difficult to answer. Are Frame and Stack set high enough? If the frame is too small, it will flow over and the µP will reset.

Michael
AV
 
Avatar
 
Subject:

Re: Permanently restart of microcontroller (by call of sleep?)

 · 
Posted: 21.11.2012 - 12:43  ·  #3
Hi Michael,

good note. Thank you very much.
After increasing the frame and stack sizes, it works fine. (-:

Andreas
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 15 · Cache Hits: 14   63   77 · Page-Gen-Time: 0.056585s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI