Skip to main content
Visitor II
June 11, 2022
Question

osDelay failed

  • June 11, 2022
  • 2 replies
  • 1031 views

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().

    This topic has been closed for replies.

    2 replies

    ST Employee
    July 29, 2022

    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.

    Graduate II
    August 9, 2022

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