Skip to main content
Senior
July 30, 2025
Solved

Question about TouchSensing

  • July 30, 2025
  • 1 reply
  • 329 views

Greetings, 
I have a question about the touchsensing module. I am using a stm32u585rit6 mcu in a custom-made board and making a project using azure rtos. I needed to add touchsensing. I watched the app_azure_rtos_config.h and noticed that there is static memory allocation via threadX memory pools (#define TOUCHSENSING_APP_MEM_POOL_SIZE   5000). Then, at the app_azure_rtos.c file there is the following: 

__ALIGN_BEGIN static UCHAR tsc_byte_pool_buffer[TOUCHSENSING_APP_MEM_POOL_SIZE] __ALIGN_END;
static TX_BYTE_POOL tsc_app_byte_pool;

if (tx_byte_pool_create(&tsc_app_byte_pool, "TOUCHSENSING App memory pool", tsc_byte_pool_buffer, TOUCHSENSING_APP_MEM_POOL_SIZE) != TX_SUCCESS)
 {
 /* USER CODE BEGIN TOUCHSENSING_Byte_Pool_Error */

 /* USER CODE END TOUCHSENSING_Byte_Pool_Error */
 }
 else
 {
 /* USER CODE BEGIN TOUCHSENSING_Byte_Pool_Success */

 /* USER CODE END TOUCHSENSING_Byte_Pool_Success */

 memory_ptr = (VOID *)&tsc_app_byte_pool;
 status = MX_TOUCHSENSING_Init(memory_ptr);
 if (status != TSL_STATUS_OK)
 {
 /* USER CODE BEGIN MX_TOUCHSENSING_Init_Error */
 while(1)
 {
 }
 /* USER CODE END MX_TOUCHSENSING_Init_Error */
 }
 /* USER CODE BEGIN MX_TOUCHSENSING_Init */

 /* USER CODE END MX_TOUCHSENSING_Init */
 }

 

What is the purpose of this memory pool? Is there any thread related to touchsensing running?
Thank you! 

Best answer by Imen.D

Hello @j_filipe ,

The memory pool in the TouchSensing module is used to reserve a specific memory space for the middleware (MW) functions of the TouchSensing module.
TOUCHSENSING_APP_MEM_POOL_SIZE is generated "hardcoded" by CubeMX. When you have ThreadX + TouchSensing MW, it will add this define, with the default value 5000 in the app_azure_rtos_config.h file, and you can change it manually in the code if needed.
The define itself is used to create the tsc_byte_pool_buffer, used for the memory context of the TouchSensing MW functions.
This "buffer" is a memory space reserved for the MW, so it is not really "used" by the MW directly.
I'll suggest having a look at the official documentation regarding that point:
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx/chapter3.md#memory-block-pools

The TouchSensing MW entry point is managed by function "MX_TOUCHSENSING_Init()", and is working in this memory pool.

Hope my answer helps you!

1 reply

Imen.DBest answer
Technical Moderator
August 11, 2025

Hello @j_filipe ,

The memory pool in the TouchSensing module is used to reserve a specific memory space for the middleware (MW) functions of the TouchSensing module.
TOUCHSENSING_APP_MEM_POOL_SIZE is generated "hardcoded" by CubeMX. When you have ThreadX + TouchSensing MW, it will add this define, with the default value 5000 in the app_azure_rtos_config.h file, and you can change it manually in the code if needed.
The define itself is used to create the tsc_byte_pool_buffer, used for the memory context of the TouchSensing MW functions.
This "buffer" is a memory space reserved for the MW, so it is not really "used" by the MW directly.
I'll suggest having a look at the official documentation regarding that point:
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/threadx/chapter3.md#memory-block-pools

The TouchSensing MW entry point is managed by function "MX_TOUCHSENSING_Init()", and is working in this memory pool.

Hope my answer helps you!

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
j_filipeAuthor
Senior
August 12, 2025

Thank you for the input!