工具与软件:
您好、TI 专家
我尝试了 rpmsg 示例代码将消息从 m62x 发送到 M4。
我想知道在没有从其他 MCU 接收任何消息的情况下可以从 m62x 发送多少条消息。
因此我修复了 rpmsg 样例源代码的 rpmsg_char_ping()函数、如下所示。
(删除 recv_msg()函数、仅发送函数)
/* single thread communicating with a single endpoint */
int rpmsg_char_ping(int rproc_id, char *dev_name, int remote_endpt,
int num_msgs, char *msg_contents)
{
int ret = 0;
int i = 0;
int packet_len;
char eptdev_name[32] = { 0 };
char packet_buf[512] = { 0 };
rpmsg_char_dev_t *rcdev;
int flags = 0;
/*
* Open the remote rpmsg device identified by dev_name and bind the
* device to a local end-point used for receiving messages from
* remote processor
*/
sprintf(eptdev_name, "rpmsg-char-%d-%d", rproc_id, getpid());
rcdev = rpmsg_char_open(rproc_id, dev_name, remote_endpt,
eptdev_name, flags);
if (!rcdev) {
perror("Can't create an endpoint device");
return -EPERM;
}
printf("Created endpt device %s, fd = %d port = %d\n", eptdev_name,
rcdev->fd, rcdev->endpt);
printf("Exchanging %d messages with rpmsg device ti.ipc4.ping-pong on rproc id %d ...\n\n",
num_msgs, rproc_id);
for (i = 0; i < num_msgs; i++) {
memset(packet_buf, 0, sizeof(packet_buf));
sprintf(packet_buf, msg_contents);
packet_len = strlen(packet_buf);
printf("Sending message #%d: %s\n", i, packet_buf);
ret = send_msg(rcdev->fd, (char *)packet_buf, packet_len);
if (ret < 0) {
printf("send_msg failed for iteration %d, ret = %d\n", i, ret);
goto out;
}
if (ret != packet_len) {
printf("bytes written does not match send request, ret = %d, packet_len = %d\n",
i, ret);
goto out;
}
/* TODO: Verify data integrity */
}
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\n");
return ret;
}
然后、我执行文件并收到错误消息
1.我可以发送42条消息,没有任何错误
root@am62xx-evm:~# ./ti_send_only -r 9 -n 42 Created endpt device rpmsg-char-9-1054, fd = 3 port = 1024 [ 88.578465] omap-mailbox 29000000.mailbox: Try increasing MBOX_TX_QUEUE_LEN Exchanging 42 messages with rpmsg device ti.ipc4.ping-pong on rp[ 88.590224] k3-m4-rproc 5000000.m4fss: failed to send mailbox message, status = -105 roc id 9 ... Sending message #0: hello there 0! Sending message #1: hello there 1! Sending message #2: hello there 2! Sending message #3: hello there 3! Sending message #4: hello there 4! Sending message #5: hello there 5! Sending message #6: hello there 6! Sending message #7: hello there 7! Sending message #8: hello there 8! Sending message #9: hello there 9! Sending message #10: hello there 10! Sending message #11: hello there 11! Sending message #12: hello there 12! Sending message #13: hello there 13! Sending message #14: hello there 14! Sending message #15: hello there 15! Sending message #16: hello there 16! Sending message #17: hello there 17! Sending message #18: hello there 18! Sending message #19: hello there 19! Sending message #20: hello there 20! Sending message #21: hello there 21! Sending message #22: hello there 22! Sending message #23: hello there 23! Sending message #24: hello there 24! Sending message #25: hello there 25! Sending message #26: hello there 26! Sending message #27: hello there 27! Sending message #28: hello there 28! Sending message #29: hello there 29! Sending message #30: hello there 30! Sending message #31: hello there 31! Sending message #32: hello there 32! Sending message #33: hello there 33! Sending message #34: hello there 34! Sending message #35: hello there 35! Sending message #36: hello there 36! Sending message #37: hello there 37! Sending message #38: hello there 38! Sending message #39: hello there 39! Sending message #40: hello there 40! Sending message #41: hello there 41! Communicated 42 messages successfully on rpmsg-char-9-1054 TEST STATUS: PASSED
2.我发送43条消息时收到错误消息
root@am62xx-evm:~# ./ti_send_only -r 9 -n 43 Created endpt device rpmsg-char-9-1060, fd = 3 port = 1024 [ 26.746459] omap-mailbox 29000000.mailbox: Try increasing MBOX_TX_QUEUE_LEN Exchanging 43 messages with rpmsg device ti.ipc4.ping-pong on rp[ 26.758212] k3-m4-rproc 5000000.m4fss: failed to send mailbox message, status = -105 roc id 9 ... Sending message #0: hello there 0! Sending mess[ 26.771521] omap-mailbox 29000000.mailbox: Try increasing MBOX_TX_QUEUE_LEN age #1: hello there 1! Sending message #2: hello there 2! Send[ 26.783949] k3-m4-rproc 5000000.m4fss: failed to send mailbox message, status = -105 ing message #3: hello there 3! Sending message #4: hello there 4! Sending message #5: hello there 5! Sending message #6: hello there 6! Sending message #7: hello there 7! Sending message #8: hello there 8! Sending message #9: hello there 9! Sending message #10: hello there 10! Sending message #11: hello there 11! Sending message #12: hello there 12! Sending message #13: hello there 13! Sending message #14: hello there 14! Sending message #15: hello there 15! Sending message #16: hello there 16! Sending message #17: hello there 17! Sending message #18: hello there 18! Sending message #19: hello there 19! Sending message #20: hello there 20! Sending message #21: hello there 21! Sending message #22: hello there 22! Sending message #23: hello there 23! Sending message #24: hello there 24! Sending message #25: hello there 25! Sending message #26: hello there 26! Sending message #27: hello there 27! Sending message #28: hello there 28! Sending message #29: hello there 29! Sending message #30: hello there 30! Sending message #31: hello there 31! Sending message #32: hello there 32! Sending message #33: hello there 33! Sending message #34: hello there 34! Sending message #35: hello there 35! Sending message #36: hello there 36! Sending message #37: hello there 37! Sending message #38: hello there 38! Sending message #39: hello there 39! Sending message #40: hello there 40! Sending message #41: hello there 41! Sending message #42: hello there 42! Communicated 43 messages successfully on rpmsg-char-9-1060 TEST STATUS: PASSED
我可以找到2个错误日志、如下所示
- [26.746459] OMAP-mailbox 29000000.mailbox:尝试增加 MBOX_TX_QUEED_LEN
- [26.758212] k3-m4-rproc 5000000.m4fss:发送邮箱消息失败,状态=-105
但我只能找到2次,并在发送 msg3后,我不能收到任何错误
3.我尝试发送257封邮件。 我得到不同的错误日志,如以下(超时错误日志和应用程序错误日志后发送256消息)
Sending message #255: hello there 255! [ 35.077819] omap-mailbox 29000000.mailbox: Try increasing MBOX_TX_QUEUE_LEN [ 35.088237] k3-m4-rproc 5000000.m4fss: failed to send mailbox message, status = -105 Sending message #256: hello there 256! [ 50.237617] rpmsg_chrdev virtio0.rpmsg_chrdev.-1.14: timeout waiting for a tx buffer Can't write to rpmsg endpt device : Unknown error 512 send_msg failed for iteration 256, ret = -1
它会受到 vring 大小256的影响、但我想知道 test#2错误日志计时。
结果我想知道如下。
1. vring 和 mailobx 之间的关系: 1 vring = 1邮箱?
2.为什么在发送第一条消息之前出现错误日志(测试2)
3.为什么我可以发送最多42条消息而没有错误日志(但缓冲区大小为256 )。
4.从用户应用程序发送到 M4内核的消息序列
(我搜索了其他核心内容、am62x 是否相同? : TMDS64EVM:关于 IPC 和邮箱-处理器论坛-处理器- TI E2E 支持论坛)
感谢您一如既往的支持!