ESP32 resets while deleting task from another task

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

ESP32 resets while deleting task from another task

Postby burkulesomesh43 » Fri Oct 19, 2018 7:24 am

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..
--
Somesh Burkule

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 resets while deleting task from another task

Postby chegewara » Fri Oct 19, 2018 8:08 am

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

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: ESP32 resets while deleting task from another task

Postby burkulesomesh43 » Fri Oct 19, 2018 10:15 am

chegewara wrote: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
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);
}

--
Somesh Burkule

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 resets while deleting task from another task

Postby chegewara » Fri Oct 19, 2018 12:27 pm

The vOtherFunction task quits without vTaskDelete. Use while or for loop in it or delete on exit.

User avatar
loboris
Posts: 514
Joined: Wed Dec 21, 2016 7:40 pm

Re: ESP32 resets while deleting task from another task

Postby loboris » Fri Oct 19, 2018 1:03 pm

It is probably better to use task notifications to request the specific task termination from another task.

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: ESP32 resets while deleting task from another task

Postby burkulesomesh43 » Fri Oct 19, 2018 7:57 pm

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
--
Somesh Burkule

chegewara
Posts: 2378
Joined: Wed Jun 14, 2017 9:00 pm

Re: ESP32 resets while deleting task from another task

Postby chegewara » Fri Oct 19, 2018 8:10 pm

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.

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: ESP32 resets while deleting task from another task

Postby burkulesomesh43 » Sat Oct 20, 2018 9:10 am

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
--
Somesh Burkule

k.ifantidis
Posts: 33
Joined: Wed Mar 28, 2018 6:58 am

Re: ESP32 resets while deleting task from another task

Postby k.ifantidis » Fri Nov 09, 2018 8:27 am

Hello there. I've been studying esp-idf FreeRTOS recently. You can read this in order to get an answer.


Regards, Kostas

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 resets while deleting task from another task

Postby Ritesh » Fri Nov 09, 2018 9:27 am

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.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 115 guests