Delete

malacay wrote on Friday, December 02, 2011:

Hi,

Wenn ich den Task lösche wird er nicht mehr aufgerufen.
Was mache ich falsch?

void main ( void )
{

  DVK_setLEDs(0x0000);
  unsigned int i;
 
  i = xTaskCreate( vZustand, “Zustand”, 1000, NULL, 1, NULL );  
   
  if( i == pdTRUE) //Task Zusatndsmaschine erstellen und abfragen ob er erstellt wurde
  {
    vTaskStartScheduler();  //Scheduler starten
  }
  else
  {
    DVK_setLEDs(0x0001);  //Anzeige Task nicht erstellt
  }
 
  while(1)
  {
    DVK_setLEDs(0x0001);
  }
 
 
}
void vZustand( void *pvParameters )
{
  const portTickType xDelay_ms = 100 / portTICK_RATE_MS;
  for(;:wink:
  {
    switch (0)
    {
    case 0:
      DVK_setLEDs(0x0000);
      xTaskCreate( vTask10, “Task 10”, configMINIMAL_STACK_SIZE, NULL, 2, &xTask10Handle );
           
      vTaskDelay(xDelay_ms);
      break;   
    default:
      state=0;
    }
  }
}
void vTask10( void *pvParameters )
{         
 
  taskdelete++;
  vTaskDelete( xTask10Handle );
 
}

rtel wrote on Friday, December 02, 2011:

You haven’t said what is not working, but……

vTaskDelete( xTask10Handle );

If you are using an older version of FreeRTOS, try changing this line to:

vTaskDelete( NULL );

malacay wrote on Friday, December 02, 2011:

Now the task is run 27 times. Then no more.
If I follow the debugging, I get the error message:
xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;

rtel wrote on Friday, December 02, 2011:

Which memory allocation method are you using?  heap_1.c, heap_2.c, heap_3.c or your own implementation?

If you are using heap_1, switch to heap_2.  See http://www.freertos.org/a00111.html

Regards.

malacay wrote on Friday, December 02, 2011:

Thank you
I’ve also noticed it straight.
https://sourceforge.net/projects/freertos/forums/forum/382005/topic/3690913
But thank you again for your prompt assistance.