Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT




Loading

ATMEGA32 resets

Posted by Nobody/Anonymous on October 7, 2005
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.

RE: ATMEGA32 resets

Posted by Nobody/Anonymous on October 7, 2005
Is there a kind of Watchdog build into FreeRTOS??

RE: ATMEGA32 resets

Posted by Nobody/Anonymous on October 8, 2005
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?

RE: ATMEGA32 resets

Posted by Richard on October 8, 2005
No, but there is on the MegaAVR. Have you switched it off?

RE: ATMEGA32 resets

Posted by Nobody/Anonymous on October 8, 2005
I hava switched off the watchdog with the function wdt_disable();

RE: ATMEGA32 resets

Posted by Richard on October 8, 2005
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.

RE: ATMEGA32 resets

Posted by Nobody/Anonymous on October 8, 2005
Are you yielding from within the ISR? If so are you doing it at the very end of the ISR (which you must do)?


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS