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.

Multicore configuration

HI,

we are using C6670 processor.Here we are able to share the data between the two cores(CORE 0 & CORE 1).If i want to share the CORE1  data to  the CORE 2,what are all changes needed in CORE2.

             This is the configuration used in CORE 0 & CORE1 project.

   CORE 0::

        if(MultiProc_self()==0)  nextProcId=1;
        if(MultiProc_self()==1)  nextProcId=0;

       .cfg:

            MultiProc.numProcessors = 2;
            MultiProc.setConfig(null, ["CORE0","CORE1"])

CORE 1:

        if(MultiProc_self()==0)  nextProcId=1;
        if(MultiProc_self()==1)  nextProcId=0;

       .cfg:

            MultiProc.numProcessors = 2;
            MultiProc.setConfig(null, ["CORE0","CORE1"])

CORE 2:  ?????????????????

Thanks & Regards

SAI

  • Hi,

    MultiProc.numProcessors = 3;
    MultiProc.setConfig(null, ["CORE0","CORE1","CORE2"])

    Thanks,
  • Hi Ganapathi,

    Initially when i want to send data between two cores CORE 0 & CORE 1,these are my configurations .....

    For CORE 0:
    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=0;
    }
    In .cfg:

    MultiProc.numProcessors = 2;
    MultiProc.setConfig(null, ["CORE0","CORE1"])


    For CORE 1:

    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=0;
    }
    In .cfg:

    MultiProc.numProcessors = 2;
    MultiProc.setConfig(null, ["CORE0","CORE1"])



    I am able to successfully transfer the data from CORE 0 to CORE1 Using Message Queues.

    So I am able to transfer data between two cores.

    Now i want to include the CORE 2 in the project for transferring the data from CORE 1 to CORE 2.
    what changes i have to make in

    In main()
    {
    -----------------------
    }
    in .cfg
    ----------------------------------------------

    when i tried with your suggestion in CORE 2

    In .cfg
    MultiProc.numProcessors = 3;
    MultiProc.setConfig(null, ["CORE0","CORE1","CORE2"])

    I Got Error like this

    ti.sdo.ipc.GateMP: line 702: E_versionMismatch: IPC Module version mismatch: creator: 0, opener: 1
    xdc.runtime.Error.raise: terminating execution


    I dont know what to include in my main() for transferring the data from CORE 1 to CORE 2.

    So please give me suggestion what i have to include in my CORE 2 main() file and .cfg file.

    Thanks & Regards
    SAI
  • Hi,

    I will check with peripheral experts and get beck to you. Meantime take a look at below thread and refer the MCSDK multicore examples
    e2e.ti.com/.../1159851

    Thanks,
  • Hi Ganapathi,

    Initially when i want to send data between two cores CORE 0 & CORE 1,these are my configurations .....

    For CORE 0:
    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=0;
    }
    In .cfg:

    MultiProc.numProcessors = 2;
    MultiProc.setConfig(null, ["CORE0","CORE1"])


    For CORE 1:

    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=0;
    }
    In .cfg:

    MultiProc.numProcessors = 2;
    MultiProc.setConfig(null, ["CORE0","CORE1"])



    I am able to successfully transfer the data from CORE 0 to CORE1 Using Message Queues.

    So I am able to transfer data between two cores.

    Now i want to include the CORE 2 in the project for transferring the data from CORE 1 to CORE 2.
    what changes i have to make in

    In main()
    {
    -----------------------
    }
    in .cfg
    ----------------------------------------------

    when i tried with your suggestion in CORE 2

    In .cfg
    MultiProc.numProcessors = 3;
    MultiProc.setConfig(null, ["CORE0","CORE1","CORE2"])

    I Got Error like this

    ti.sdo.ipc.GateMP: line 702: E_versionMismatch: IPC Module version mismatch: creator: 0, opener: 1
    xdc.runtime.Error.raise: terminating execution


    I dont know what to include in my main() for transferring the data from CORE 1 to CORE 2.

    So please give me suggestion what i have to include in my CORE 2 main() file and .cfg file.

    Thanks & Regards
    SAI
  • Hi SAI,

    As per my understanding, give it a try like the configuration given below, if you want to share the data from core 0 to core 1, core 1 to core 2.

    Let us know whether this works.

    Point No: 1

    For CORE 0:


    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=2;

    if(MultiProc_self()==2) nextProcId=0;


    }
    In .cfg:

    MultiProc.numProcessors = 3;
    MultiProc.setConfig(null, ["CORE0","CORE1", "CORE2"])


    For CORE 1:

    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=2;

    if(MultiProc_self()==2) nextProcId=0;
    }
    In .cfg:

    MultiProc.numProcessors = 3;
    MultiProc.setConfig(null, ["CORE0","CORE1","CORE2"])

    For CORE 2:

    In main()
    {
    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=2;

    if(MultiProc_self()==2) nextProcId=0;
    }
    In .cfg:

    MultiProc.numProcessors = 3;
    MultiProc.setConfig(null, ["CORE0","CORE1","CORE2"])

    Regards,

    Shankari

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    --------------------------------------------------------------------------------------------------------

  • hi shankari,
    HI shankari,

    I tried with your configuration but it is not working.Here i am posting the three core configurations and main.c respectively.
    Here the CORE 0 tansfers the data to CORE1 ,CORE1 receives the data and prints the data also but CORE2 is not receiving the data from CORE1(It enters into CORE2 and even prints System_printf("THIRD CORE\n") and it is not printing the received buffer and also it is not terminating the core(not abort CORE2).

    ***********************************************************************************
    CORE 0:
    ***********************************************************************************
    main.c

    typedef struct MyMsg {
    MessageQ_MsgHeader header;
    SAI_BYTE in_bits[10];
    } MyMsg;
    Void tsk0_func(UArg arg0, UArg arg1)
    {
    MessageQ_Handle messageQ;
    MessageQ_QueueId remoteQueueId;
    Int status;
    UInt16 msgId = 0;
    HeapBufMP_Handle heapHandle;
    HeapBufMP_Params heapBufParams;

    /*
    * Create the heap that will be used to allocate messages.
    */
    HeapBufMP_Params_init(&heapBufParams);
    heapBufParams.regionId = 0;
    heapBufParams.name = HEAP_NAME;
    heapBufParams.numBlocks = 3;
    heapBufParams.blockSize = 500000; //sizeof(MessageQ_MsgHeader);
    heapHandle = HeapBufMP_create(&heapBufParams);
    if (heapHandle == NULL) {
    System_abort("HeapBufMP_create failed\n" );
    }



    /* Register this heap with MessageQ */
    MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);

    /* Create the local message queue */
    messageQ = MessageQ_create(localQueueName, NULL);
    if (messageQ == NULL) {
    System_abort("MessageQ_create failed\n" );
    }

    /* Open the remote message queue. Spin until it is ready. */
    do {
    status = MessageQ_open(nextQueueName, &remoteQueueId);
    /*
    * Sleep for 1 clock tick to avoid inundating remote processor
    * with interrupts if open failed
    */
    if (status < 0) {
    Task_sleep(1);
    }
    } while (status < 0);

    SAI_UINT32 pkt_cnt;
    SAI_UINT32 input_len = TB_SIZE;

    SAI_BYTE poly_type;
    if ( CHOOSE_POLY == ONE )
    {
    poly_type = CRC24A;
    }
    else if( CHOOSE_POLY == TWO )
    {
    poly_type = CRC24A;
    }
    else if(CHOOSE_POLY == THREE)
    {
    poly_type = CRC16;
    }
    else if( CHOOSE_POLY == FOUR)
    {
    poly_type = CRC8;
    }
    else
    {
    printf("Invalid please choose within 4 number\n");
    }

    /* Allocate a message to be ping-ponged around the processors */
    qmsg = (MyMsg *) malloc( sizeof(MyMsg)*10);

    qmsg= (MyMsg *)MessageQ_alloc(HEAPID, sizeof(MyMsg));
    if (qmsg== NULL) {
    System_abort("MessageQ_alloc failed\n" );
    }
    printf("CRC ENCODING\n");
    for( pkt_cnt = 0; pkt_cnt < input_len; pkt_cnt ++)
    {
    qmsg->in_bits[pkt_cnt] = rand() % TWO;
    printf("%d\n",qmsg->in_bits[pkt_cnt]);
    }
    Temp_LTE_CRC_CODE_encode ( qmsg->in_bits,input_len, poly_type);
    /* int k;
    for(k=0;k<10000;k++)
    printf("%d",qmsg->in_bits[k]);
    printf("k_value:%d",k);*/
    /*
    * Send the message to the next processor and wait for a message
    * from the previous processor.
    */
    System_printf("Start the main loop\n");
    while (msgId < 1) {
    /* Increment...the remote side will check this */
    msgId++;
    MessageQ_setMsgId(qmsg, msgId);

    System_printf("Sending a message #%d to %s\n", msgId, nextQueueName);

    /* send the message to the remote processor */
    status = MessageQ_put(remoteQueueId, (MessageQ_Msg)qmsg);
    if (status < 0) {
    System_abort("MessageQ_put had a failure/error\n");
    }


    }


    System_printf("The test is complete\n");
    BIOS_exit(0);
    }

    /*
    * ======== main ========
    * Synchronizes all processors (in Ipc_start) and calls BIOS_start
    */
    Int main(Int argc, Char* argv[])

    {
    Int status;



    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=2;

    if(MultiProc_self()==2) nextProcId=0;

    printf("nextProcId:%d",nextProcId);


    /* Generate queue names based on own proc ID and total number of procs */
    System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self()));
    System_sprintf(nextQueueName, "%s", MultiProc_getName(nextProcId));

    /*
    * Ipc_start() calls Ipc_attach() to synchronize all remote processors
    * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
    */
    status = Ipc_start();
    printf("hi\n");
    if (status < 0) {
    System_abort("Ipc_start failed\n");
    }
    ****************************************************************
    CORE 1:
    ***************************************************************

    typedef struct MyMsg {
    MessageQ_MsgHeader header;
    SAI_BYTE in_bits[10];
    } MyMsg;

    SAI_UCHAR
    Temp_LTE_CRC_CODE_decode ( SAI_BYTE in_bits[], SAI_UINT32 input_len,
    SAI_UCHAR poly_type );

    /*
    * ======== tsk0_func ========
    * Allocates a message and ping-pongs the message around the processors.
    * A local message queue is created and a remote message queue is opened.
    * Messages are sent to the remote message queue and retrieved from the
    * local MessageQ.
    */
    Void tsk0_func(UArg arg0, UArg arg1)
    {
    SAI_UINT32 input_len =TB_SIZE;
    SAI_BYTE poly_type;
    MessageQ_Handle messageQ;
    MessageQ_QueueId remoteQueueId;
    Int status;
    UInt16 msgId = 0;
    HeapBufMP_Handle heapHandle;

    MyMsg * nmsg = 0;

    /* Open the heap created by the other processor. Loop until opened. */
    do {
    status = HeapBufMP_open(HEAP_NAME, &heapHandle);
    /*
    * Sleep for 1 clock tick to avoid inundating remote processor
    * with interrupts if open failed
    */
    if (status < 0) {
    Task_sleep(1);
    }
    } while (status < 0);


    /* Register this heap with MessageQ */
    MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);


    /* Create the local message queue */
    messageQ = MessageQ_create(localQueueName, NULL);
    if (messageQ == NULL) {
    System_abort("MessageQ_create failed\n" );
    }

    /* Open the remote message queue. Spin until it is ready. */
    do {
    status = MessageQ_open(nextQueueName, &remoteQueueId);
    /*
    * Sleep for 1 clock tick to avoid inundating remote processor
    * with interrupts if open failed
    */
    if (status < 0) {
    Task_sleep(1);
    }
    } while (status < 0);
    nmsg = (MyMsg *) malloc( sizeof(MyMsg)*10);

    nmsg= (MyMsg *)MessageQ_alloc(HEAPID, sizeof(MyMsg));
    if(nmsg==NULL)
    System_printf("memory not created\n");
    /*
    * Wait for a message from the previous processor and
    * send it to the next processor
    */
    System_printf("Start the main loop\n");
    int j=1;
    while (j==1) {
    /* Get a message */
    status = MessageQ_get(messageQ, (MessageQ_Msg *)&nmsg, MessageQ_FOREVER);
    if (status < 0) {
    System_abort("This should not happen since timeout is forever\n");
    }

    System_printf("Sending a message #%d to %s\n", MessageQ_getMsgId(nmsg),
    nextQueueName);

    /* Get the message id */
    msgId = MessageQ_getMsgId(nmsg);

    /* send the message to the remote processor */
    /* status = MessageQ_put(remoteQueueId, (MessageQ_Msg)nmsg);
    if (status < 0) {
    System_abort("MessageQ_put had a failure/error\n");
    }*/

    /* test done */
    if (msgId >= NUMLOOPS) {
    break;
    }
    j++;
    }
    printf("\n decoding\n");
    int k;
    for(k=0;k<24;k++)
    {
    printf("%d\n",nmsg->in_bits[k]);
    }

    Temp_LTE_CRC_CODE_decode ( nmsg->in_bits, input_len, 1 );
    int i;
    status = MessageQ_put(remoteQueueId, (MessageQ_Msg)nmsg);
    if (status < 0) {
    System_abort("MessageQ_put had a failure/error\n");
    }

    /*for(i=0;i<24;i++)
    printf("%d\n",nmsg->in_bits[i]);*/
    System_printf("The test is complete\n");
    BIOS_exit(0);
    }

    /*
    * ======== main ========
    * Synchronizes all processors (in Ipc_start) and calls BIOS_start
    */
    Int main(Int argc, Char* argv[])
    {
    Int status;

    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=2;

    if(MultiProc_self()==2) nextProcId=0;
    /* Generate queue names based on own proc ID and total number of procs */
    System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self()));
    System_sprintf(nextQueueName, "%s", MultiProc_getName(nextProcId));

    /*
    * Ipc_start() calls Ipc_attach() to synchronize all remote processors
    * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
    */
    status = Ipc_start();
    if (status < 0) {
    System_abort("Ipc_start failed\n");
    }

    BIOS_start();

    return (0);
    }
    *********************************************************************
    CORE 2:
    ***********************************************************************
    typedef struct MyMsg {
    MessageQ_MsgHeader header;
    SAI_BYTE in_bits[10];
    } MyMsg;

    //SAI_UCHAR
    //Temp_LTE_CRC_CODE_decode ( SAI_BYTE in_bits[], SAI_UINT32 input_len,
    // SAI_UCHAR poly_type );

    /*
    * ======== tsk0_func ========
    * Allocates a message and ping-pongs the message around the processors.
    * A local message queue is created and a remote message queue is opened.
    * Messages are sent to the remote message queue and retrieved from the
    * local MessageQ.
    */
    Void tsk0_func(UArg arg0, UArg arg1)
    {
    SAI_UINT32 input_len =TB_SIZE;
    SAI_BYTE poly_type;
    MessageQ_Handle messageQ;
    MessageQ_QueueId remoteQueueId;
    Int status;
    UInt16 msgId = 0;
    HeapBufMP_Handle heapHandle;

    MyMsg * nmsg = 0;



    /* Open the heap created by the other processor. Loop until opened. */
    do {
    status = HeapBufMP_open(HEAP_NAME, &heapHandle);
    /*
    * Sleep for 1 clock tick to avoid inundating remote processor
    * with interrupts if open failed
    */
    if (status < 0) {
    Task_sleep(1);
    }
    } while (status < 0);


    /* Register this heap with MessageQ */
    MessageQ_registerHeap((IHeap_Handle)heapHandle, HEAPID);


    /* Create the local message queue */
    messageQ = MessageQ_create(localQueueName, NULL);
    if (messageQ == NULL) {
    System_abort("MessageQ_create failed\n" );
    }

    /* Open the remote message queue. Spin until it is ready. */
    do {
    status = MessageQ_open(nextQueueName, &remoteQueueId);
    /*
    * Sleep for 1 clock tick to avoid inundating remote processor
    * with interrupts if open failed
    */
    if (status < 0) {
    Task_sleep(1);
    }
    } while (status < 0);
    nmsg = (MyMsg *) malloc( sizeof(MyMsg)*10);

    nmsg= (MyMsg *)MessageQ_alloc(HEAPID, sizeof(MyMsg));
    if(nmsg==NULL)
    System_printf("memory not created\n");
    /*
    * Wait for a message from the previous processor and
    * send it to the next processor
    */
    System_printf("THIRD CORE\n");
    System_printf("Start the main loop\n");
    int j=1;
    while (j==1) {
    /* Get a message */
    status = MessageQ_get(messageQ, (MessageQ_Msg *)&nmsg, MessageQ_FOREVER);
    if (status < 0) {
    System_abort("This should not happen since timeout is forever\n");
    }
    // System_printf("got message %d\n", nmsg->Ibuf);
    System_printf("Sending a message #%d to %s\n", MessageQ_getMsgId(nmsg),
    nextQueueName);

    /* Get the message id */
    msgId = MessageQ_getMsgId(nmsg);

    j++;
    }

    int i;
    for(i=0;i<24;i++)
    System_printf("%d\n",nmsg->in_bits[i]);

    System_printf("The third core test is complete\n");
    BIOS_exit(0);
    }

    /*
    * ======== main ========
    * Synchronizes all processors (in Ipc_start) and calls BIOS_start
    */
    Int main(Int argc, Char* argv[])
    {
    Int status;

    if(MultiProc_self()==0) nextProcId=1;
    if(MultiProc_self()==1) nextProcId=2;

    if(MultiProc_self()==2) nextProcId=0;

    /* Generate queue names based on own proc ID and total number of procs */
    System_sprintf(localQueueName, "%s", MultiProc_getName(MultiProc_self()));
    System_sprintf(nextQueueName, "%s", MultiProc_getName(nextProcId));

    /*
    * Ipc_start() calls Ipc_attach() to synchronize all remote processors
    * because 'Ipc.procSync' is set to 'Ipc.ProcSync_ALL' in *.cfg
    */
    status = Ipc_start();
    if (status < 0) {
    System_abort("Ipc_start failed\n");
    }

    BIOS_start();

    return (0);
    }

    Thanks
    SAI