Our processor runs a server in the background which listens for commands. We can command it to send a low value to a pin, wait a bit, and then reset the pin to the default high value.
Because of the running server, It is important that the above process is executed as a separate task.
As stated here http://www.freertos.org/a00126.html, we create the task (via
xTaskCreate(mixer, "Mixer", UINT32_C(2048), NULL, UINT32_C(2), &mixerTask)
) which calls the following function:
~~~
void mixer(void * pvParameters) {
(void) pvParameters;
// set PIN LOW code here
vTaskDelay(1000);
// set PIN HIGH code here
vTaskDelete(mixerTask); // delete the task itself (memory is scheduled for being freed)
}
~~~
The task runs each time our server receives a specific command, which is ~10-20 seconds.
Apart from the server, we have a timer (created via
vTimerCreate
) running every 600ms performing a simple task.
The problem is that we run out of memory after 3 calls to the
vTaskCreate
function. Searching the web reveals that the IDLE task is responsible for freeing the memory after the call to
vTimerDelete
.
Should we create this IDLE task ourselves or how else can we solve this problem?