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.

J784S4XEVM: IPC Synchronization failure

Part Number: J784S4XEVM

Tool/software:

I am implementing IPC communication between a Linux host and the MCU2_0 core using RPMessage. The goal is to trigger a radar configuration task on the MCU2_0 core upon receiving an IPC request from Linux, and then send a status flag back to Linux once the task completes.

I’m using a semaphore to synchronize the IPC request and task execution. However, I’m encountering a timeout issue on the Linux side, indicating a synchronization failure between the IPC request and the MCU’s response.

Why might this timeout occur, and how can I resolve it? Are there better synchronization mechanisms for this use case? Please suggest debugging steps or alternative approaches.


  • Hello,

    The goal is to trigger a radar configuration task on the MCU2_0 core upon receiving an IPC request from Linux, and then send a status flag back to Linux once the task completes.

    May i know how you are sending the IPC request from Linux to MCU2_0 core?

    I’m using a semaphore to synchronize the IPC request and task execution. However, I’m encountering a timeout issue on the Linux side, indicating a synchronization failure between the IPC request and the MCU’s response.

    On MCU2_0 what OS are you using ? Are you using IPC LLD driver on MCU2_ to sync the IPC request from linux ?

    Regards

    Tarun Mukesh

  • May i know how you are sending the IPC request from Linux to MCU2_0 core?
    int rpmsg_char_ping(int rproc_id, char *dev_name, unsigned int local_endpt, unsigned int remote_endpt,
    int num_msgs)
    {
    int ret = 0;
    int i = 0;
    int packet_len;
    char eptdev_name[64] = {0};
    char packet_buf[512] = {0};
    rpmsg_char_dev_t *rcdev;
    int flags = 0;
    struct timespec ts_current;
    struct timespec ts_end;
    /* Open the remote rpmsg device */
    sprintf(eptdev_name, "rpmsg-char-%d-%d", rproc_id, getpid());
    rcdev = rpmsg_char_open((enum rproc_id)rproc_id, dev_name, local_endpt, remote_endpt,
    eptdev_name, flags);
    if (!rcdev) {
    perror("Can't create an endpoint device");
    return -EPERM;
    }
    printf("Starting Radar Interface Test\n\n");
    printf("Created endpt device %s, fd = %d port = %d\n", eptdev_name,
    rcdev->fd, rcdev->endpt);
    printf("Exchanging %d messages with rpmsg device %s on rproc id %d ...\n\n",
    num_msgs, eptdev_name, rproc_id);
    for (i = 0; i < num_msgs; i++) {
    memset(packet_buf, 0, sizeof(packet_buf));
    sprintf(packet_buf, "Configure %d!", i);
    packet_len = strlen(packet_buf) + 1; // Include null terminator
    printf("Sending message #%d: %s\n", i, packet_buf);
    clock_gettime(CLOCK_MONOTONIC, &ts_current);
    ret = send_msg(rcdev->fd, packet_buf, packet_len);
    if (ret < 0) {
    printf("send_msg failed for iteration %d, ret = %d\n", i, ret);
    return ret;
    goto out;
    }
    if (ret != packet_len) {
    printf("bytes written does not match send request, ret = %d, packet_len = %d\n",
    ret, packet_len);
    goto out;
    }
    uint32_t flag;
    int reply_len;
    ret = recv_msg(rcdev->fd, &flag, &reply_len);
    clock_gettime(CLOCK_MONOTONIC, &ts_end);
    if (ret < 0) {
    printf("recv_msg failed for iteration %d, ret = %d\n", i, ret);
    goto out;
    }
    /* MODIFIED SECTION: Accept any non-zero flag as valid */
    if (reply_len != sizeof(flag) || flag == 0) {
    printf("Invalid flag received for iteration %d: flag=%u, len=%d\n",
    i, flag, reply_len);
    ret = -1;
    goto out;
    }
    printf("Received flag for message #%d: %u, round trip delay(usecs) = %ld\n",
    i, flag, (ts_end.tv_sec - ts_current.tv_sec) * 1000000 +
    (ts_end.tv_nsec - ts_current.tv_nsec) / 1000);
    }
    printf("\nCommunicated %d messages successfully on %s\n\n",
    num_msgs, eptdev_name);
    out:
    ret = rpmsg_char_close(rcdev);
    if (ret < 0)
    perror("Can't delete the endpoint device");
    return ret;
    }

    I am sending the ipc request as a message "Configure 0!" from linux to RTOS core which is highlighted above.
    On MCU2_0 what OS are you using ? Are you using IPC LLD driver on MCU2_ to sync the IPC request from linux ?
    FreeRTOS.
    Yes, the code uses the IPC Low-Level Driver (LLD) on MCU2_0 to handle inter-processor communication (IPC),
    including synchronization with Linux running on the A72 core (MPU1_0).