About intertask communication

Hello!
I want switch tasking in my way of code execution
For do this I use queues, but it doesnt resolve all cases

I have several threads
Threads data is on the queues
But I need to check UART data comming in another threads by default or in IDLE state. This thread do not reveive anything from queue.

How can I take control to switch to this thread from another thread, without queue?
In UART thread I check uart->Instance->SR on UART_IDLEFL
UART Thread:

void startUartProc(void *argument)
{
  UART_HandleTypeDef* uartRx = uartProc;
  char* bufferPoint = uartProcBuffer;
  
  for(;;)
  {
    if (uart_idle(uartRx) == uY)
    {
    	
    	if(TCP_en)
    	{
    		bufferPoint = data_proc(TCPProcHandle, bPoint);
    	}
    	else

    	bufferPoint = data_proc(uartProcHandle, bPoint);
   	
    }

    osDelay(10);
   
  }

}

UART init

static void MX_UART7_Init(void)
{

  /* USER CODE BEGIN UART7_Init 0 */

  /* USER CODE END UART7_Init 0 */

  /* USER CODE BEGIN UART7_Init 1 */

  /* USER CODE END UART7_Init 1 */
  huart7.Instance = UART7;
  huart7.Init.BaudRate = 115200;
  huart7.Init.WordLength = UART_WORDLENGTH_8B;
  huart7.Init.StopBits = UART_STOPBITS_1;
  huart7.Init.Parity = UART_PARITY_NONE;
  huart7.Init.Mode = UART_MODE_TX_RX;
  huart7.Init.HwFlowCtl = UART_HWCONTROL_NONE;
  huart7.Init.OverSampling = UART_OVERSAMPLING_16;
  if (HAL_UART_Init(&huart7) != HAL_OK)
  {
    Error_Handler();
  }

}

Thanks in advance

I have no idea how that functions as you don’t say which processor you are using - but in any case it is probably too low level a detail to make a difference to the answer.

It is not clear exactly what you are asking, so I will try and rephrase what you are asking to see if I get it right.

You have an application with multiple tasks, and when data arrives on the UART you want to switch to the task that processes the data.

Is that right?

If you want the UART task to run every time data arrives then the best thing to do is have the UART task at a high priority, and use the UART interrupt to unblock the task when data arrives. If the task is the highest priority at that point the interrupt service routine will return directly to the task. You could do that by having the interrupt service routine write received data to a stream buffer. Then have the task that processes the data block on the stream buffer. Each data data is available it is placed in the stream buffer, unblocking the task which processes the data.

There are several other examples in the book and on the FreeRTOS website, such as using a task notification. There is example code on this page.

Thank you for your answer!
Yes your right
I thought what an exist more way rather then Uart Interrupt

Thanks