Issue related to vTaskDelete of freeRTOS

cancel
Showing results for 
Search instead for 
Did you mean: 

Issue related to vTaskDelete of freeRTOS

1,592 Views
durgeshtanuku
Contributor II

In our appliction i have created a task taskResponseToMaster() that has to be executed only at certain event in the code. So at that event I have created the task (as it is not a periodic task, i have not used for loop). so at the end of the task i am deleting the task using vTaskDelete(NULL). At that instance it's not yielding the processor and going into PE_DEBUGHAULT();

 

I am attaching the code to this post, the task I have said is at line number 545 of ./lib/slave.c and the task create statement is at line number 97 of ./lib/slave.c.

 

regards,

Durgesh

Original Attachment has been moved to: Gateway_New.rar

Labels (1)
Tags (1)
0 Kudos
2 Replies

555 Views
BlackNight
NXP Employee
NXP Employee

Hi Durgesh,

As your project is not complete, I cannot run it. But I see that you are using NULL as parameter to vTaskDelete(), so this does not match what you are saying in report above?

pastedImage_0.png

You are creating tasks in slave.c in several places using a *local* variable names taskHandle, which is very problematic.

Can you set a breakpoint on above line of vTaskDelete() in the debugger and check if taskHandle is indeed NULL?

And I would use NULL just to make sure that you are not accidentially deleting a different task, as you are using a global task handle variable:

pastedImage_1.png

And actually this is your problem (I think), because on line 319 (function readInputStatusHandler()) you are setting that handle for Task3:

pastedImage_2.png

So in essence, in taskResponseToMaster() you are not deleting yourself, you are deleting Task3.

And no wonder that taskResponseToMaster() will crash as it has not been deleted.

I hope this helps,

Erich

555 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Durgesh Tanuku:

I think you are using Processor Expert, right?

The execution can enter in the PE_DEBUGHALT() because of many different reasons. The next tutorials by colleague Erich Styger can help you to analyze your code and find what is causing this issue:

Oh my! An Interrupt… | MCU on Eclipse

Debugging Hard Faults on ARM Cortex-M | MCU on Eclipse

A Processor Expert Component to Help with Hard Faults | MCU on Eclipse


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------