Page 1 of 2
ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 7:24 am
by burkulesomesh43
Hi all,
I want to delete the tasks from other task.(eg. task A and task B can be delete in task C).I am trying to delete this tasks using task handlers. but as I delete it, esp32 is reseting..
Re: ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 8:08 am
by chegewara
Can you post command, how you delete it? I am suspecting you may pass pointer but vTaskDelete parameter is handle variable:
https://www.freertos.org/a00126.html
Re: ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 10:15 am
by burkulesomesh43
I am trying like this->>
Code: Select all
TaskHandle_t vTaskCodeHandle= NULL;
TaskHandle_t vOtherFunctionHandle= NULL;
void vOtherFunction( void )
{
// Use the handle to delete the task.
if( vTaskCodeHandle!= NULL )
{
vTaskDelete( vTaskCodeHandle);
}
}
void vTaskCode( void )
{
while(1){
ESP_LOGI("TEST","DEBUG");
}
}
void app_main(void)
{
xTaskCreate( vTaskCode, "NAME", 2048, NULL, 1, &vTaskCodeHandle);
xTaskCreate( vOtherFunction, "name", 2048, NULL, 1, &vOtherFunctionHandle);
}
Re: ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 12:27 pm
by chegewara
The vOtherFunction task quits without vTaskDelete. Use while or for loop in it or delete on exit.
Re: ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 1:03 pm
by loboris
It is probably better to use task notifications to request the specific task termination from another task.
Re: ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 7:57 pm
by burkulesomesh43
chegewara wrote:The vOtherFunction task quits without vTaskDelete. Use while or for loop in it or delete on exit.
tried within while loop but also resets esp32
Re: ESP32 resets while deleting task from another task
Posted: Fri Oct 19, 2018 8:10 pm
by chegewara
This is what i meant:
Code: Select all
void vOtherFunction( void )
{
// Use the handle to delete the task.
if( vTaskCodeHandle!= NULL )
{
vTaskDelete( vTaskCodeHandle);
}
for(;;){ // <-- infinite loop to not allow task exit
}
// OR
while(1){}
// OR
vTaskDelete(NULL); // destroy this task (vOtherFunction)
}
PS Its weird that compiler allows you have task function with void type parameter, because task should have void* parameter.
Re: ESP32 resets while deleting task from another task
Posted: Sat Oct 20, 2018 9:10 am
by burkulesomesh43
chegewara wrote:This is what i meant:
Code: Select all
void vOtherFunction( void )
{
// Use the handle to delete the task.
if( vTaskCodeHandle!= NULL )
{
vTaskDelete( vTaskCodeHandle);
}
for(;;){ // <-- infinite loop to not allow task exit
}
// OR
while(1){}
// OR
vTaskDelete(NULL); // destroy this task (vOtherFunction)
}
PS Its weird that compiler allows you have task function with void type parameter, because task should have void* parameter.
Not working. esp32 resets..
gives error-> store prohibited
Re: ESP32 resets while deleting task from another task
Posted: Fri Nov 09, 2018 8:27 am
by k.ifantidis
Hello there. I've been studying esp-idf FreeRTOS recently.
You can read this in order to get an answer.
Regards, Kostas
Re: ESP32 resets while deleting task from another task
Posted: Fri Nov 09, 2018 9:27 am
by Ritesh
Hi,
Would you please provide you crash logs for same? Also would you please try it by adding few delays between creating both tasks?
Because, we are also deleting tasks from other tasks into our application without any issue.