FreeRTOS10.3.1 vTaskDelete() problem on MSP432

Good day, I’m on a case using FreeRTOS10.3.1 on MSP432P401R, when I use vTaskDelete() , it always go to prvTaskExitError(), I try to use it in blinky_demo from MSP432LauchPad Demo, still the same .

This is the code in blinky_demo:

static void prvQueueSendTask( void *pvParameters )
{
TickType_t xNextWakeTime;
const unsigned long ulValueToSend = 100UL;

	/* Check the task parameter is as expected. */
	configASSERT( ( ( unsigned long ) pvParameters ) == mainQUEUE_SEND_PARAMETER );

	/* Initialise xNextWakeTime - this only needs to be done once. */
	xNextWakeTime = xTaskGetTickCount();

	for( ;; )
	{
		/* Place this task in the blocked state until it is time to run again.
		The block time is specified in ticks, the constant used converts ticks
		to ms.  While in the Blocked state this task will not consume any CPU
		time. */
		vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );

		/* Send to the queue - causing the queue receive task to unblock and
		toggle the LED.  0 is used as the block time so the sending operation
		will not block - it shouldn't need to block as the queue should always
		be empty at this point in the code. */
		xQueueSend( xQueue, &ulValueToSend, 0U );
		vTaskDelete(NULL);
	}
}

Sincere apologies for the delay in reply - somehow your post went by unnoticed…

When a task deletes another task the memory allocated for use by the task when it was created is deleted immediately. However when a task deletes itself, as per your code, then the task should stop running immediately but the memory is not deleted until the Idle task runs next.

Does your system run as expected until the task deletes itself?
Do you know which task is hitting the task exit error? It might not be the task that is deleting itself. Ways to know which task it is are to use a FreeRTOS aware debugger, look at the stack frame, or inspect “pxCurrentTCB” in the debugger as that contains the text name of the task (you may have to cast it to “(tskTCB)pxCurrentTCB” to see the structure members).