Quality RTOS & Embedded Software

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


Loading

xTaskResume STM32

Posted by stmiko on June 18, 2010
Hello,

I using FreeRTOS for differents tasks and one of them calls vTaskSuspendAll() to suspend all real time activity. After performing the operation i want to reactivate the scheduler with xTaskResumeAll(). But the tasks don´t start to work. I have generated the TickHook ISR the check the scheduler and count up a variable in this function. This works fine but the tasks don´t work again after calling the resume order...
Does anybody know this problem?

Regards

Stephan

RE: xTaskResume STM32

Posted by Dave on June 18, 2010
Can you post a small section of code where these calls are made? Maybe you are in a critical section when calling the functions?

If you post some code please use the codify text tags so the formatting does not get all screwy.

RE: xTaskResume STM32

Posted by stmiko on June 18, 2010


static portTASK_FUNCTION( vMenuTask, pvParameters )
{
portTickType xLastPollTime;


/* The parameters are not used. */
( void ) pvParameters;

xLastPollTime = xTaskGetTickCount();

while(1)
{
vTaskDelayUntil( &xLastPollTime, 1 / portTICK_RATE_MS ); //alle 1 ms

if(uiTrigger ==1)
{


Ack(C_BUSY); //SIPLUG in Messung

}
else
{

Menu();//Charakerter empfangen ? -> verarbeiten
}

}

}

void Menu(void)
{

//do something else...

switch (c)
{

/* Uhrzeit setzen */
case 'u':
{

Time.Weekday = status.datetime.Weekday;
Time.Year = status.datetime.Year;
Time.Month = status.datetime.Month;
Time.Date = status.datetime.Date;
Time.Hour = status.datetime.Hour;
Time.Minute = status.datetime.Minute;
Time.Second = status.datetime.Second;

vTaskSuspendAll();

if(Parameter2(&Time,sizeof(Time))!=0) break;

du[0] =BCDToInt(Time.Weekday);
du[1] =BCDToInt16(Time.Year);
du[2] =BCDToInt(Time.Month);
du[3] =BCDToInt(Time.Date);
du[4] =BCDToInt(Time.Hour);
du[5] =BCDToInt(Time.Minute);
du[6] =BCDToInt(Time.Second);

SetTime(du[4], du[5], du[6]);//clock_calender.h
SetDate(du[3], du[2], du[1]);

if( !xTaskResumeAll() )
{
TaskYIELD ();
}


break;
}
//There are more switch cases...



Thanks

RE: xTaskResume STM32

Posted by Richard on June 18, 2010
The line:

if(Parameter2(&Time,sizeof(Time))!=0) break;


breaks out of the case statement while the scheduler is still suspended. Calls to vTaskSuspendAll() can nest, so exactly the same number of calls to xTaskResumeAll() must be made as previous calls to vTaskSuspendAll() before the scheduler is resumed. When your problem occurs inspect the value of uxSchedulerSuspended (in tasks.c) and you will probably find that it is not zero.

Regards.

RE: xTaskResume STM32

Posted by stmiko on June 18, 2010
Hello Richard,

I´ve changed the code according to your answer and know it works!

Thanks!!!


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner