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.

MCU-PLUS-SDK-AM64X: Multiple RPMessage Endpoints all mapped to the same object in localEndPtObj[]

Part Number: MCU-PLUS-SDK-AM64X

I am using SDK 11.00.00.15, and I am working with the RPMessage implementation included in TI IPC.
I am trying to register multiple local endpoints with my own callback (OnRPMessage) across a range of endpoint IDs.

However, I am facing the following problem:
Even though I loop through multiple endpoint IDs, all entries in gIpcRpmsgCtrl.localEndPtObj[] end up pointing to the same RPMessage object.
As a result, the endpoints do not behave independently.

 

What I am doing:
for (int i = 0 ; i < 7 ; i++)
{
    RPMessage_CreateParams_init(&createPrms);
    createPrms.localEndPt = i;
    createPrms.recvCallback = RPMessage_User_Callback_Handler;
    status = RPMessage_construct(&gIpcRpmsgCtrl.controlEndPtObj, &createPrms);
    if (SystemP_SUCCESS != status)
    {
        break;
    }
}
Here, controlEndPtObj is the only RPMessage_Object defined in gIpcRpmsg_Ctrl in the TI SDK.
 

Because I pass the same object (controlEndPtObj) every time:

  • RPMessage_construct() stores that same pointer in localEndPtObj[i]
  • therefore all entries end up identical:
localEndPtObj[4] → &controlEndPtObj
localEndPtObj[5] → &controlEndPtObj
localEndPtObj[6] → &controlEndPtObj
...

 Thus multiple endpoints cannot operate independently.

 

Question:

Is RPMessage designed such that each local endpoint must have its own dedicated RPMessage_Object instance?
If yes:

1. Is it correct that I should allocate an array of RPMessage_Object for user-defined endpoints?
2. Is there any official or recommended way to create multiple endpoints with callbacks?
3. Is it acceptable to extend IpcRpmsg_Ctrl, like:

CRPMessage_Object userEndPtObj[RPMESSAGE_MAX_LOCAL_ENDPT];

    and pass &userEndPtObj[i] to RPMessage_construct()?
4. Or does TI recommend a different design for handling multiple custom endpoints?

 

Best regards,
Hiroki Hoshina

  • Hi,

    I have checked the driver code and yes the understanding is correct here. The gIpcRpmsgCtrl object have only one controlEndPtObj object which is overridden every time if same RPMessage_Object is used as the RPMessage_Object's localEndPtObj points to this object.

    1. Is it correct that I should allocate an array of RPMessage_Object for user-defined endpoints?

    Yes, You can create an array of RPMessage_Object to separately store handlers for each endpoint.

    2. Is there any official or recommended way to create multiple endpoints with callbacks?
    4. Or does TI recommend a different design for handling multiple custom endpoints?

    You can refer to the rpmsg_echo example provided in the SDK. We have created different RPMessage_Object for different endpoints.

    3. Is it acceptable to extend IpcRpmsg_Ctrl, like:

    Yes, this should work. Let us know if you face any issues.

    Regards,

    Tushar

  • Hi Tushar-san,

    Thank you very much for reviewing code.


    In particular, the note from the rpmsg_echo example:

    /* RPMessage_Object MUST be global or static */
    static RPMessage_Object gRecvMsgObject;
    was very informative and helped me understand the issue clearly.
    I really appreciate your support and the time you spent looking into the details.
    Best regards,
    Hiroki Hoshina
  • I really appreciate your support and the time you spent looking into the details.

    Glad to know the above. Thank you for your kind words.

    Regards,

    Tushar