Quality RTOS & Embedded Software

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




Loading

Task freezes but the status is eReady (xmega AVR + freeRTOS)

Posted by mishung on September 16, 2016

Good day everyone. I have an issue that have been bugging me for about three days now. After I put the microcontroller to sleep (power save) and wake it up again, sometimes (like 10% of the time) one of the tasks freezes at a random line of code so it looks like its an issue with freeRTOS. The status of the task remains eReady but it just won't execute anymore. Is this even possible or should I look for problem somewhere else? Any idea on what could give me the clue about whats happening (aside from the eReady status)?

AVR: Xmega256A3U

Thank you! ...and sorry for not providing any code but it's literally thousands of lines.


Task freezes but the status is eReady (xmega AVR + freeRTOS)

Posted by rtel on September 16, 2016

How are you putting the processor to sleep?

Does the clock keep running? What happens to 'time' when asleep? Does the tick wake the system up from sleep? Do the CPU registers and RAM retain their values while asleep?


Task freezes but the status is eReady (xmega AVR + freeRTOS)

Posted by mishung on September 16, 2016

I put it to sleep by setting the mode to power-save, setting the sleep enable register and running sleep_cpu (from avr/sleep.h) in a while loop. The condition in while is a (hi/low) status of a certain input pin. I have tried to suspend all task with vTaskSuspendAll() and resuming them after waking the processor from sleep but it had no effect on the malfunctioning task. The CPU registers and RAM retain their content. The task never failed to launch if I just reset the processor (erasing all the volatile memory in process). The strangest thing is the inconsistency of the result. I can put the processor to sleep for an exact ammount of seconds, observe the outcome, reset the whole setup and do the exact same thing again and sometimes (most of the time, like 90%) it works, but sometimes it freezes on the most random places in the code.


Task freezes but the status is eReady (xmega AVR + freeRTOS)

Posted by mishung on September 17, 2016

reply below


Task freezes but the status is eReady (xmega AVR + freeRTOS)

Posted by rtel on September 17, 2016

I put it to sleep by setting the mode to power-save, setting the sleep enable register and running sleep_cpu (from avr/sleep.h) in a while loop

Without digging through the data sheets I wouldn't know what the effect of that was.

The CPU registers and RAM retain their content.

Ok, good. What about the clock clock that generates the tick interrupt? Does that stop in sleep mode? The reason for asking is that if the processor is in sleep mode past a tick interrupt (it stays sleeping for one or more tick interrupts) then you need to adjust the tick count when you come out of sleep mode. Otherwise a task that would wake up in 100 ticks if the processor didn't go to sleep, would wake up 100 ticks after the processor came out of sleep mode - even if the processor was in sleep mode for 99 tick periods. The tickless low power examples use the vTaskStepTick() function for that purpose.


[ 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