cancel
Showing results for 
Search instead for 
Did you mean: 

osDelay failed

AFaya.1
Associate III

I am working with stm32h753zi board and i am tring to implement the task swithcing logic, if task 1 is running task 2 wait on while loop and while task 2 is running task1 should wait of while loop. I task 2 locked inside the osDelay().

2 REPLIES 2
Artur IWANICKI
ST Employee

Hello,

In Task2 code there is no incrementation of user_count, so all will work for first 2000 iterations of Default Task (task1), then it will stay on 2001 and Task2 will stay in the first while loop.

Adding user_count++; after first osDelay(10) in StartTask02() function should solve the issue, but I would limit it from the top as it will count till max 16bit or 32bit number and the application will spend much more time in Task2 vs Task1.

Piranha
Chief II

Learn a proper thread synchronization - flags, events, semaphores, message queues...