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

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 ]    [ 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