Freertos task, required large stack for one ESP_LOG printout

Stipa88
Posts: 20
Joined: Mon May 09, 2022 12:26 pm

Freertos task, required large stack for one ESP_LOG printout

Postby Stipa88 » 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?

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
	}
}
Pls help. Tnx

ESP_Sprite
Posts: 9772
Joined: Thu Nov 26, 2015 4:08 am

Re: Freertos task, required large stack for one ESP_LOG printout

Postby ESP_Sprite » Thu Jan 25, 2024 9:37 am

The stack size in ESP-IDF is defined in bytes, see the note at the bottom of this chapter.

Who is online

Users browsing this forum: Baidu [Spider] and 116 guests