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.

LAUNCHXL-CC1352P: Inter-task communication using OSALPort

Part Number: LAUNCHXL-CC1352P
Other Parts Discussed in Thread: Z-STACK

Hello,

I am a beginner in TI-RTOS and I don't understand how to make 2 tasks communicate together (Task A to send a message to Task B). Lets take the example of the "Light and Switch example applications on the CC13x2 and CC26x2" (https://dev.ti.com/tirex/explore/node?node=ANbR0LtTwkMnDCiEhygF7A__pTTHBmu__LATEST). In this document, the communication between the Thread and RTOS is described using OSALPort.This communication work by registering the Thread in OSALPort using TaskID, SemaphoreHandle and EventHandler. Fine.

Now, let's imagine that I have another task aside to the first one. Let say that one of the task is the one from a simple example (i.e. Zigbee Switch example) and the other tack is managing some computation and want to transmit the result of this computation through Zigbee task to something else. My first assumption was that it will be possible, using OSALPort, to send a message (Event + Semaphore) to Zigbee task. BUT. But I have a problem: to do so, I need the TaskID of Zigbee task. And it is only available as a private variable in the task, so I don't see any way to get it in my "computation" task.

So, here are my questions:

1. Am I wrong on the way to communicate between one task and another? I didn't find the architecture of communication between to independent tasks in TI-RTOS anywhere, so if someone have a diagram, please share it Slight smile

2. If I am right, how can I make the TaskID of the Zigbee task available for the Computation task? I didn't find any clear example of this situation. The best approaching example in my opinion is "zr_ota_server_CC26X2R1_LAUNCHXL_tirtos_ccs" but I didn't found in it the answer to my questions. I will appreciate an architecture diagram describing the structure of communication and a full flow diagram to confirm or not the communication template.

3. If I am wrong, I will appreciate any help, link to documentation or anything else that make me not only able to do it but also to understand it, which is the most important for me.

Thanks.

Best regards,

  • Hello Christophe,

    zstackstartup.c has a dedicated function, stackTask_getStackServiceId, which specifically returns the stackServiceId for the zstackapi.c to store as stackServiceTaskId inside Zstackapi_init so that the sampleApp task can use it to send messages to the Zigbee stack.   The NPI task has a similar setup with MTTask_getServiceTaskId so that messages can be sent to the MT layer using MTServiceTaskID.  You can similarly exploit existing stack/task IDs to effectively communicated between tasks or processing elements using OsalPort_msgSend. Registering to receive messages can be slightly more difficult as you will need to subscribe to specific callbacks/indications.  Here is a link to the Z-Stack User Guide section covering the OsalPort Framework but it will take time to fully study and understand. 

    More simple thread synchronization inside application tasks can be easily accomplished through use of semaphores and events.

    Regards,
    Ryan 

  • Hello Ryan,

    Thanks a lot for your clear explanations and your advices. I will have a look to semaphore and events as it is not clear yet for me how to find, from myTask, the semaphore handle of zStack. I really appreciate the time you spend to answer me with so many details.

    Christophe