Quality RTOS & Embedded Software

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




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) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists