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.

CC2674P10: How to prioritize tasks correctly?

Part Number: CC2674P10

Tool/software:

Hello
I am developing a project based on the MultiRole example. My question is how to set priorities correctly.
Let's say I have three tasks.

1. ICall task. I assume that this task is responsible for interacting with the radio channel equipment. Its priority is 5.
2. MultiRole task. This is a user task that processes incoming events from the RF stack. That is, it reads data from the service, sends a notification, etc. Its priority is, say, 4.
3. Protocol task. This task receives/transmits processed data to the MultiRole task to communicate with another device. Its priority is currently 7 (the highest).

If for some reason the data processing in task #3 takes a long time, then due to the high priority, task #1 (ICall) will not be called, the active connection confirmation packets will not be sent. And therefore, the other side can terminate the connection unilaterally.
I assume that because of the high priority of 3, during which the connection will be disconnected, task 1 will not even know about the disconnection.

What are the rules for setting task priorities?

Should the ICall task have the highest priority among tasks that interact with the RF stack in any way?

Is it possible to increase some parameter in the ti _ble _config .h file that will tell both sides to wait long enough without exchanging packets (say 5-10 seconds) and not disconnect.

  • Hi,

    Thank you for reaching out. We will take a look at your question and get back to you as soon as possible.

    Best Regards,

    Jan

  • Hello Nick,

    Thanks for reaching out.

    We recommend to let the ICall (BLE stack) task have the highest priority to avoid situations as the one you describe. Priorities of the ICall tasks are set to 5 by default using a function such as ICall_createRemoteTasks() which runs after initializing ICall. Although it might not be the exaclty what you are describing, I would suggest a look at:

    • Connection supervision timeout: maximum amount of time between two successful connection events. If this time passes without a successful connection event, the device terminates the connection and returns to an unconnected state.
    • Peripheral Latency: This parameter gives the peripheral device the option of skipping a number of connection events. This ability gives the peripheral device some flexibility. If the peripheral does not have any data to send, it can skip connection events, stay asleep, and save power. The peripheral device selects whether to wake or not on a per connection event basis. The peripheral can skip connection events but must not skip more than allowed by the peripheral latency parameter or the connection fails.

    BR,

    David.