AnsweredAssumed Answered

UM1722 On semaphores example

Question asked by William chang on Jun 24, 2017
Latest reply on Jun 24, 2017 by William chang

I am using cubemx v4.21.0. and the freertos version is 8.2.3. & the cmsis-rtos version is 1.02.

I am using the examples of STM32F413ZH-Nucleo in stm32cube F4 v1.16.0 , when I download the program. It works wrong!

I found the issure  here

static void SemaphoreThread2(void const *argument)
{
....

 

for (;;)
{
if (semaphore != NULL)
{
/* Try to obtain the semaphore */
if (osSemaphoreWait(semaphore , 0) == osOK)

If I use if (osSemaphoreWait(semaphore , osWaitForever) == osOK)  instead,It works fine!

Could anyone tell me why  if (osSemaphoreWait(semaphore , 0) == osOK) works wrong?

Outcomes