Skip to main content
Associate
Question

Re: Freertos semaphore not initialised correctly by CubeMX

A new question moved from this post.

I have the opposite issue with STM32CubeIDe v1.18 / MX v6.14.0, I want my semaphore initial state to be depleted, but that is not applied to my code:

MarcosOrzari_0-1741352328612.png

 

 

 /* creation of DebugUartStringReadySem */
 DebugUartStringReadySemHandle = osSemaphoreNew(1, 1, &DebugUartStringReadySem_attributes);

 

 

My .ioc file seems ok:

 

 

rtos.0.binarySems.0=allocationType,Dynamic;controlBlockName,NULL;initialState,Depleted;name,DebugUartStringReadySem

 

 

 

This topic has been closed for replies.

5 replies

dmarks-ls
Associate III

Hi Marcos,

Random user here... I'm able to reproduce your error.  I have a starter project for TouchGFX on the STM32U5 using FreeRTOS, so I added two semaphores, one that starts available, one that starts depleted.

binary_semaphores.png

Here's the code that CubeMX generated:

void MX_FREERTOS_Init(void) {
 /* USER CODE BEGIN Init */

 /* USER CODE END Init */

 /* USER CODE BEGIN RTOS_MUTEX */
 /* add mutexes, ... */
 /* USER CODE END RTOS_MUTEX */
 /* creation of sem_available */
 sem_availableHandle = osSemaphoreNew(1, 1, &sem_available_attributes);

 /* creation of sem_depleted */
 sem_depletedHandle = osSemaphoreNew(1, 1, &sem_depleted_attributes);

Clearly, that's not correct.  ST, please verify and correct this issue.  (I'm using CubeIDE 1.18.0, CubeMX 6.14.0, STM32Cube FW_U5 v1.7.0.)

Dana M.

ST Technical Moderator

Hello @MarcosOrzari 

Thank you for posting!

Could you provide the name of the MCU where you encountered the issue?

KR,

Souhaib

To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Associate

Sure, it's the STM32U585VITx.

ST Technical Moderator

Hello @MarcosOrzari 

This issue has been fixed in the MCU part numbers supporting native FREERTOS such as H7RS, F1, etc. However, it still exists in other MCU part numbers that do not support natively FREERTOS. It will be fixed in the coming revisions of X-Cube-FREERTOS.

KR,

Souhaib

To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Andrei Chichak
Lead

Also happens with STM32H563ZITx as of 2025-10-21.

CubeMX 6.15.0

Firmware STM32Cube FW_H5 1.5.0

STMicroelectronics.X-CUBE-FREERTOS.1.3.1

A