FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [June 2010 Threads] xTaskResume STM32Posted 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 STM32Posted 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 STM32Posted 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 STM32Posted 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 STM32Posted by stmiko on June 18, 2010 Hello Richard,
I´ve changed the code according to your answer and know it works!
Thanks!!!
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|