Hi!
I'm working with the EVMK2H board (Rev 4.0), MCSDK v3.1.4.7 and IPC v3.36.02.13. I'm trying to have a very basic application for testing purposes. The goal is simply to send a message from DSP to ARM and then back from ARM to DSP. The configuration used on the DSP side is the same as the one provided in the image processing demo. Everything seems to work fine on the ARM side as I am able to open the DSP's queue and send it a message and receive one on the ARM's local queue. Receiving the sent message on the DSP side however doesn't seem to work. The error message I got is also given when trying to open the ARM's queue although this operation ends up working.
Here is the report:
root@k2hk-evm:~/keystone2_tests/arm/tests/hwi/hwi_test_arm_MessageQ# ./hwi_test_arm_MessageQ Initializing IPC module... done! Creating receiving message queue... done. Opening dsp queue... done! Waiting for message from DSP... done! RECEIVED ACK FOR INTERRUPT #0. Sending message to dsp... Message sent! root@k2hk-evm:~/keystone2_tests/arm/tests/hwi/hwi_test_arm_MessageQ# cat /sys/kernel/debug/remoteproc/remoteproc1/trace0 3 Resource entries at 0x800000 registering rpmsg-proto service on 61 with HOST Opening arm queue... [t=0x271cc334] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 53 [t=0x27583acd] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 53 [t=0x2a67a916] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x35eae895] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x416f9fdf] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x49dae1e9] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x52b85e8d] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x5e3aeb6d] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x69bf7101] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x7541e4a1] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x80ca684d] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x8c4d2173] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x92927a50] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0x9d93f0a1] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xa91a71cf] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xb49d1e29] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xc021e5b1] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xcba48349] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xd72ee151] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 done! Creating MessageQ... done! Sending message to ARM... done! Waiting for message from ARM... [t=0xdcef6b46] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xe2b32f45] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 0 [t=0xe2b98e4d] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 53 [t=0xe2cc96db] ti.ipc.rpmsg.RPMessage: RPMessage_send: no object for endpoint: 53 error.
The lad report seemed good at first sight but here it is in case I missed something. I also attach the DSP and ARM code.
Thanks in advance,
Thomas.
/* SysLink/IPC Headers: */
#include <ti/ipc/Std.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
#include <ti/ipc/transports/TransportRpmsg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "mpmclient.h"
#include "hwi_tests_common.h"
#define DSP_OUT "./keystone2_tests.out"
#ifndef MSGQ_GET_TIMEOUT
#define MSGQ_GET_TIMEOUT 7500000
// MessageQ_FOREVER for infinite time
#endif // MSGQ_GET_TIMEOUT
typedef struct {
MessageQ_MsgHeader header; // Required, usage reserved to the MessageQ module
int16_t core_id;
uint8_t workload;
} hwi_test_messageQ_t;
static inline int spawn_dsp(const char *dsp_name, const char *prog_path) {
int err = 0;
if (mpm_reset(dsp_name, &err) < 0) {
fprintf(stderr, "mpm_reset error: %i\n", err);
}
if (mpm_load(dsp_name, prog_path, &err) < 0) {
fprintf(stderr, "mpm_load error: %i\n",err);
}
if (mpm_run(dsp_name, &err) < 0) {
fprintf(stderr, "mpm_run error: %i\n", err);
}
return err;
}
int spawn_dsps() {
spawn_dsp("dsp0", DSP_OUT);
spawn_dsp("dsp1", DSP_OUT);
spawn_dsp("dsp2", DSP_OUT);
spawn_dsp("dsp3", DSP_OUT);
spawn_dsp("dsp4", DSP_OUT);
spawn_dsp("dsp5", DSP_OUT);
spawn_dsp("dsp6", DSP_OUT);
spawn_dsp("dsp7", DSP_OUT);
return 0;
}
int main(void) {
int8_t status = 0;
int8_t ret = 0;
// LAUNCHING DSP (HAVE TO BE DONE BEFORE INITIALIZING THE IPC MODULE!)
if (spawn_dsps()) {
return -1;
}
// IPC CONFIGURATION
MessageQ_Handle msgQ;
MessageQ_Params msg_params;
// Configuring transport:
Ipc_transportConfig(&TransportRpmsg_Factory);
// Initializing IPC module:
fprintf(stdout, "Initializing IPC module...");
if (Ipc_start() < 0) {
fprintf(stderr, "Ipc_init failed, exiting now.\n");
return -1;
} else {
fprintf(stdout, " done!\n");
}
fprintf(stdout, "Creating receiving message queue...");
/* Create the local Message Queue for receiving. */
MessageQ_Params_init(&msg_params);
msgQ = MessageQ_create("hwi_test_MQ_arm", &msg_params);
if (msgQ == NULL) {
fprintf(stderr, "Error in MessageQ_create\n");
return -1;
} else {
fprintf(stdout, " done.\n");
}
// Open the DSP's Message Queue:
fprintf(stdout, "Opening dsp queue... ");
MessageQ_QueueId dsp_qid;
do {
status = MessageQ_open("hwi_test_MQ_dsp", &dsp_qid);
} while (status == MessageQ_E_NOTFOUND || status == MessageQ_E_TIMEOUT);
if (status < 0) {
fprintf(stderr, " Error #%i while opening the MessageQ.\n", status);
ret = -1;
goto end;
} else {
fprintf(stdout, "done!\n");
}
MessageQ_Msg msg_proxy;
hwi_test_messageQ_t *msg_dsp;
// Wait for an ACK to come
fprintf(stdout, "Waiting for message from DSP...");
status = MessageQ_get(msgQ, &msg_proxy, MSGQ_GET_TIMEOUT);
if (status < 0) {
fprintf(stderr, "Error while getting message.\n");
ret = -1;
goto end;
} else {
fprintf(stdout, " done!\n");
}
msg_dsp = (hwi_test_messageQ_t *) msg_proxy;
uint8_t dsp_isr_count = msg_dsp->workload;
// Terminate application by sending a final message to the DSP:
fprintf(stdout, "Sending message to dsp...\n");
hwi_test_messageQ_t *msg = (hwi_test_messageQ_t *) MessageQ_alloc(0,128);
if (msg == NULL) {
fprintf(stderr, "MessageQ_alloc failed\n");
}
msg->core_id = 1337;
msg->workload = 12;
status = MessageQ_put(dsp_qid, (MessageQ_Msg) msg);
if (status < 0) {
fprintf(stderr, "MessageQ_put failed.\n");
ret = -1;
goto end;
}
fprintf(stdout, "Message sent!\n");
end:
MessageQ_delete(&(msgQ));
Ipc_stop();
return ret;
}
#include <stdint.h>
#include <c6x.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <ti/sysbios/hal/Hwi.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/MessageQ.h>
#include "hwi_tests_common.h"
typedef struct {
MessageQ_MsgHeader header; // Required, usage reserved to the MessageQ module
int16_t core_id;
uint8_t workload;
} hwi_test_messageQ_t;
static volatile unsigned int wait = 1;
static MessageQ_QueueId arm_qid;
static uint8_t isr_count = 0;
static void send_msg(void) {
int status = -1;
hwi_test_messageQ_t *msg = (hwi_test_messageQ_t *) MessageQ_alloc(0,
sizeof(hwi_test_messageQ_t));
if (msg == NULL) {
System_abort("MessageQ_alloc failed\n");
}
msg->core_id = DNUM;
msg->workload = isr_count;
status = MessageQ_put(arm_qid, (MessageQ_Msg) msg);
if (status < 0) {
System_abort("MessageQ_put failed\n");
}
}
int hwi_test_arm_MessageQ(void) {
if (DNUM != 1) {
System_printf("Nothing to do!\n");
while(1);
//return 1;
}
int status = -1;
MessageQ_Params msg_params;
MessageQ_Handle msgQ;
MessageQ_Msg msg_proxy;
System_printf("Opening arm queue... ");
do {
status = MessageQ_open("hwi_test_MQ_arm", &arm_qid);
} while (status == MessageQ_E_NOTFOUND || status == MessageQ_E_TIMEOUT);
if (status < 0) {
System_printf("Unable to open the MessageQ: error #%i\n",
status);
System_abort("Exiting program.\n");
} else {
System_printf("done!\n");
}
/* Create the local Message Queue for receiving. */
MessageQ_Params_init(&msg_params);
System_printf("Creating MessageQ...");
msgQ = MessageQ_create("hwi_test_MQ_dsp", &msg_params);
if (!msgQ) {
System_abort(" error.\n");
} else {
System_printf(" done!\n");
}
System_printf("Sending message to ARM...");
send_msg();
System_printf(" done!\n");
System_printf("Waiting for message from ARM...\n");
Hwi_disableInterrupt(12);
status = MessageQ_get(msgQ, &msg_proxy, 7500000);
if (status < 0) {
System_abort(" error.\n");
}
Hwi_enableInterrupt(12);
System_printf("Got one!\n");
return 0;
}