Freertos task, required large stack for one ESP_LOG printout
Posted: Thu Jan 25, 2024 7:43 am
Hi.
I am creating a task. In the task function, within the for(;;) loop, I periodically print one LOG message via the ESP_LOGI function-definition.
In order for it to work, without crash and ESP reset, a stack of "1650" (stack is defined in words) size is required. 6.44kB is the task necessary? Why so many? Where is the problem?
Pls help. Tnx
I am creating a task. In the task function, within the for(;;) loop, I periodically print one LOG message via the ESP_LOGI function-definition.
In order for it to work, without crash and ESP reset, a stack of "1650" (stack is defined in words) size is required. 6.44kB is the task necessary? Why so many? Where is the problem?
Code: Select all
void prvADCNewDataTask( void *);
TaskHandle_t xHandleADCNewDataTask = NULL;
void CreateADC_Task()
{
ESP_LOGI(TAG, "Create_ADC_Task...");
xTaskCreate( prvADCNewDataTask, "ADCData_Task", 1650, NULL, tskIDLE_PRIORITY + 1, &xHandleADCNewDataTask);
ESP_LOGI(TAG, "Success Create_ADC_Task");
}
void prvADCNewDataTask(void * argument)
{
ESP_LOGI(TAG, "ADCNewDataTask Started");
volatile uint32_t stackHighWaterMark = 0;
for(;;)
{
vTaskDelay(100);
stackHighWaterMark = uxTaskGetStackHighWaterMark(xHandleADCNewDataTask);
ESP_LOGI(TAG, "Free: %u words", stackHighWaterMark); // stackHighWaterMark = 24
}
}