ATMEGA32 resets

Hello, My AVR ATMEGA32 resets automatic after a fixed amount of task cycles. I have 3 tasks running 2 of them control leds and one for I2C communication. It is always after a fixed amount (120) of I2C communication cycles that MCU starts over again. Can it be a stack overflow or is TOTAL_HEAP_SIZE == 500 too small?? Regards Adrian.

ATMEGA32 resets

Is there a kind of Watchdog build into FreeRTOS??

ATMEGA32 resets

I found out that if I turn all variables in my functions to static variables it keeps running (longer?). Is there anyway to monitor the actual heap/stack size??. The example program increments a reset counter  in EEPROM at the start of the main() function, how do I read the current value?

ATMEGA32 resets

No, but there is on the MegaAVR.  Have you switched it off?

ATMEGA32 resets

I hava switched off the watchdog with the function wdt_disable();

ATMEGA32 resets

The stacks are filled with 0xa5, so you can stop on the debugger, inspect the stack, and see where the high water mark is. When you have the trace facility enabled there is a function prvListTaskWithinSingleList() within tasks.c that in turn calls usTaskCheckFreeStackSpace().  However it is difficult to use these functions if you have very limited RAM.  Also these functions leave interrupts disabled for an extended period so they are ok for debugging, but not recommended for normal use. Before making the variables static it was taking a particular length of time for your application to crash – suggesting a possible cause being the stack getting used up. Now by making the variables static you are removing most of the stack usage – and the program runs longer.  This would suggest that whatever is using up the stack is still causing a problem and nothing has really changed, its just that making the variables static you are delaying the symptom.  This would suggest that there is an unrelated cause – maybe interrupts not completing correctly? Regards.

ATMEGA32 resets

Are you yielding from within the ISR?  If so are you doing it at the very end of the ISR (which you must do)?