cancel
Showing results for 
Search instead for 
Did you mean: 

FreeRTOS acquisition and release?

Kai_Satone
Associate II

Hello Everyone,

I have a Problem with to acquisition DATA  from One TASK to another and release data.

And there is another problem that I can not access  Data from One task to another task.

how to use and when can we use , in this code i have to use acquisition and release process in this given code.

i have to send latitude , longitude ,objectTemp and ambientTemp by EC200u(message) and take data from temp sensor and L89.

 

 

void StartTask1(void *argument)
{
  /* USER CODE BEGIN 5 */
  /* Infinite loop */

  for(;;)
  {



	  while(!sendHTTP(Latitude, Longitude, objectTemp, ambientTemp)){
		  osSemaphoreAcquire(myCountingSem, osWaitForever);

		  if(count < 1){
				count++;
		  }
		  else{
				break;
			}
		  osSemaphoreRelease(myCountingSem);
		}



    osDelay(100);
  }
  /* USER CODE END 5 */
}

/* USER CODE BEGIN Header_StartL89 */
/**
* @brief Function implementing the L89 thread.
*  argument: Not used
* @retval None
*/
/* USER CODE END Header_StartL89 */
void StartL89(void *argument)
{
  /* USER CODE BEGIN StartL89 */
  /* Infinite loop */
  for(;;)
  {

		  uint8_t count = 0;

		  while(Latitude == 4 || Latitude == 1)
		  {
			  osSemaphoreAcquire(myCountingSem, osWaitForever);
			  HAL_UART_Receive(&huart2, (uint8_t *)Rxdata, 700, 5000);
			  get_location(&Latitude, &Longitude,0);
			  //	L89_TogglePin(2,3);
			  if(count < 1)
			  {
				  count++;
				  //	EC200_TogglePin(5,3);
			  }
			  else
			  {
				  break;
			  }
			  osSemaphoreRelease(myCountingSem);
		  }


    osDelay(1);
  }
  /* USER CODE END StartL89 */
}

 

2 REPLIES 2
Pavel A.
Evangelist III

Here you can find an expert in FreeRTOS to help with you project.

 

nouirakh
ST Employee

Hello @Kai_Satone 

For data acquisition and release, you would be looking for examples that use queues, semaphores, or mutexes. Look for examples named with patterns like FreeRTOS_Queue, FreeRTOS_Semaphore, or similar, as these will demonstrate inter-task communication and synchronization.
Typically, you would find the example in the firmware packages for the STM32F4, STM32F7, STM32L4, or other series that support FreeRTOS. You can find STM32Cube MCU Packages STM32Cube MCU Packages.
Once you understand how the example works, you can adapt the synchronization and communication mechanisms to your specific application needs.
Please note that the exact names and availability of examples may vary depending on the STM32 series and the version of the STM32Cube firmware package. If you have the STM32CubeMX tool installed, you can also generate code that includes FreeRTOS and then add your inter-task communication mechanisms as needed.