This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RTOS/CC2650: Two Tasks, synchronizing function calls

Part Number: CC2650

Tool/software: TI-RTOS

Hello,

I am current running two tasks task1 and task2. These two tasks refer to global Boolean variables to decide which external functions are executed from within the task. Each task also contains an infinite while loop (while(1)) to continuously execute these functions. What I'm noticing is that the task with the highest priority continuously executes its while loop and calls the external functions, while the task with the lower priority never even begins (I know this by the fact that the called functions would print a message to the screen). How do I switch control between multiple tasks at discrete moments (not based on clock ticks, just Boolean variable states). I want to control the flow of task execution, halting one, allowing the other to execute, then halting that one, and returning to the original (basically a trade off between tasks). Please provide a detailed/thorough explanation as I am quite new to this concept.

 Many thanks!

  • Hi Anthony,

    As long as the higher priority task is running, the other lower priority tasks will never execute.

    We would probably need to have more details about what you want to achieve:

    • do both tasks need to share the CPU 50% of the time each
    • Only execute the lower priority task when a certain event occurs
    • Should the tasks execute on certain events
    • Should the tasks execute at a certain interval

    To get you started, in order to allow the lower priority task to run, you need to put the higher priority task in a "paused" state. There are many ways of doing it (i.e. Task_Sleep, semaphores, mutex, etc.)

    I recommend that you take a look at the BIOS (TI-RTOS kernel) User Guide:

    It is available from the Resource Explorer. In CCS under the View menu or online at the address below:

    http://dev.ti.com/tirex

    In the resource explorer, follow the path:

    Software->TI-RTOS for CC2650 xxx -> Documents -> Documentation Links

    On the documentation page, you can open the TI-RTOS Kernel User Guide.

    You can also open the TI-RTOS Kernel Runtime APIs and Configuration (cdoc) for a reference of all the functions. The synchronization modules are found under the following path:

    ti->sysbios->knl

    Regards,

    Michel

  • Many thanks, the Kernel User Guide is actually fantastic