cancel
Showing results for 
Search instead for 
Did you mean: 

CMSIS RTOS V1 Semaphore issues in STM32CubeIDE

DLim.16
Associate II

Hi,

I am using STM32F405, CMSIS RTOS V1, and STM32CubeIDE. I want to create a timer interrupt that periodically release the semaphore to signal the execution of a task.

The issue is that it gets stuck after osSemaphoreRelease is called in the interrupt. Please refer to my source code.

How do I troubleshoot this?

Thanks.

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Super User

Dont think so, because Semaphore1Handle is passed as a parameter to the task.

In the task you are checking if the semaphore was created., makes sense.

But, in HAL_TIM_PeriodElapsedCallback you are not checking.

Maybe the first IRQ comes too early. Try shifting the line HAL_TIM_Base_Start_IT(&htim3); down.

View solution in original post

4 REPLIES 4
Karl Yamashita
Principal

You have two different semaphores. One that looks like CubeMX created "Semaphore1Handle" which you release. Then you create another in StartDefaultTask "semaphore" which you wait on.

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.
KnarfB
Super User

Dont think so, because Semaphore1Handle is passed as a parameter to the task.

In the task you are checking if the semaphore was created., makes sense.

But, in HAL_TIM_PeriodElapsedCallback you are not checking.

Maybe the first IRQ comes too early. Try shifting the line HAL_TIM_Base_Start_IT(&htim3); down.

Pavel A.
Super User

osSemaphoreRelease is a RTOS API. Do you think it can be called from an interrupt handler? and is the priority of the interrupt low enough to use RTOS calls?

-- pa

I did that, and it worked, thanks!!!