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.

CCS/TMS320C6678: Notify_sendEvent can not get right result

Part Number: TMS320C6678


Tool/software: Code Composer Studio

Hello everyone:

 I want to use Notify send information from core0 to core1 on my EVM6678L board.

I write a simple code: Core 1 registerEvent : status=Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL), and cor 0 send event :status=Notify_sendEvent(1, 0, EVENTID, 0, TRUE)

,I always get the status back  from core0 : event has no registered callback,I can not find out the problem,

and I try other methods:

  • Core 1  status=Notify_registerEvent(1, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL)      Core 0 status=Notify_sendEvent(1, 0, EVENTID, 0, TRUE)
  • Core 1  status=Notify_registerEvent(1, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL)      Core 0 status=Notify_sendEvent(0, 0, EVENTID, 0, TRUE)
  • Core 1  status=Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL)      Core 0 status=Notify_sendEvent(1, 0, EVENTID, 0, TRUE)
  • Core 1  status=Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL)      Core 0 status=Notify_sendEvent(0, 0, EVENTID, 0, TRUE)

I get the same result : event has no registered callback!

I have read the question :e2e.ti.com/support/processors/f/791/p/661148/2429976?tisearch=e2e-quicksearch&keymatch=Ipc.procSync#2429976)

and have read :Processor sdk rtos 06_03_00_106 ->4.4.6.8 Notify Module and->4.4.7.2 MultiProc Module 

I think the code is ok,Can any one give some suggestion ?

code :

#include "EVM_init.h"

uint32_t maxFlashes = 3;
uint32_t EVENTID = 0;
UInt16 srcProc, dstProc;

Void cbFxn(UInt16 procId, UInt16 lineId, UInt32 eventId, UArg arg, UInt32 payload)
{
    Semaphore_post(semHandle);
}
void ledPlayTask (void)
{
    Int status;
    uint32_t coreId;
    coreId = CSL_chipReadReg (CSL_CHIP_DNUM);
    switch(coreId)
    {
    case 0:
        platform_write("core %d is working\n",coreId);
        while(Ipc_attach(1))
        {
            Task_sleep(1);
        }
        status = Notify_sendEvent(1, 0, EVENTID, 0, TRUE);//core0 sendEvent
        my_print_status_for_Notify_sendEvent(status);
        break;
    case 1:
        platform_write("core %d is working\n",coreId);
        while(Ipc_attach(0))
        {
            Task_sleep(1);
        }
        Semaphore_pend(semHandle,BIOS_WAIT_FOREVER);
        platform_write("Core0 to core1 Notify event successfully!\n",coreId);
        break;
    }
}
Int main()
{
    Int status;
    platform_write("*****************************\n");
    status = Ipc_start();
    if (status < 0) {
    System_abort("Ipc_start failed\n");
    }
    if(MultiProc_self()==1)//Core1 register event callback function:
    {
        status = Notify_registerEvent(0, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL);
        if (status < 0) {
            System_abort("Notify_registerEvent failed\n");
        }
        else
        {
            platform_write("Core 1 ,registerEvent 0 \n",);
        }
    }
    BIOS_start();
    return(0);
}

and the confige .cfg:

var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var Startup= xdc.useModule('xdc.runtime.Startup');
var Csl = xdc.loadPackage('ti.csl');

var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

//Program.argSize = 0x0;
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
Defaults.common$.namedModule = false;
System.maxAtexitHandlers = 4;       
Error.raiseHook = null;
Text.isLoaded = false;
SysMin.flushAtExit = false;
BIOS.heapSize = 0x8000;
BIOS.libType = BIOS.LibType_Custom;
Program.stack = 0x2000;
SysMin.bufSize = 0x200;
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Error.raiseHook = null;
Text.isLoaded = false;
Main.common$.diags_INFO = Diags.ALWAYS_ON;
System.SupportProxy = SysMin;
SysMin.flushAtExit = false;

Program.sectMap[".const"] = "DDR3";
Program.sectMap[".text"] = "DDR3"; 
Program.sectMap[".code"] = "DDR3"; 
Program.sectMap[".data"] = "DDR3";
Program.sectMap[".sysmem"] = "DDR3"; 
Program.sectMap[".sharedVar"] = "DDR3";
Program.sectMap["platform_lib"] = "DDR3";
var SHAREDMEM           = 0x80000000;
var SHAREDMEMSIZE       = 0x00200000;
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
SharedRegion.setEntryMeta(0,
    { base: SHAREDMEM, 
      len:  SHAREDMEMSIZE,
      ownerProcId: 0,
      isValid: true,
      name: "DDR3",
    });

Startup.firstFxns.$add('&EVM_init');
var tskNdkMainThread = Task.create("&ledPlayTask"); 
tskNdkMainThread.stackSize = 0x2000;
tskNdkMainThread.priority = 0x5; 
tskNdkMainThread.instance.name = "ledPlayTask";
Program.global.semHandle = Semaphore.create(0);
//MessageQ:
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
var MessageQ = xdc.useModule('ti.sdo.ipc.MessageQ');

var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
//Program.global.procName = "CORE0";
var nameList = MultiProc.getDeviceProcNames();
MultiProc.setConfig(null, nameList);
/* To avoid wasting shared memory for MessageQ transports */
for (var i = 0; i < MultiProc.numProcessors; i++) {
    Ipc.setEntryMeta({
        remoteProcId: i,
        setupMessageQ: false,
    });
}
var Notify      = xdc.useModule('ti.sdo.ipc.Notify');
/* Synchronize all processors (this will be done in Ipc_start) */
//Ipc.procSync = Ipc.ProcSync_ALL;
Ipc.procSync = Ipc.ProcSync_PAIR;

output:

[C66xx_0] core 0 is working
[C66xx_1] Core 1 ,registerEvent 0
core 1 is working
[C66xx_0] event has no registered callback

If I use Core 1 to send and Core 1 to receive ,it is ok:

Core 1 status=Notify_registerEvent(1, 0, EVENTID,(Notify_FnNotifyCbck)cbFxn, NULL) Core 1 status=Notify_sendEvent(1, 0, EVENTID, 0, TRUE)
I get the right result : event successfully sent! But If different core ,it does not work.

I use CCS10.1 ,ipc_3_50_04_08 ,pdk_C6678_1_1_2_5,bios_6_76_03_01

#include "EVM_init.h"

uint8_t *Osal_platformMalloc (uint32_t num_bytes, uint32_t alignment)
{
    return malloc(num_bytes);
}
void Osal_platformFree (uint8_t *dataPtr, uint32_t num_bytes)
{
    if (dataPtr)
    {
        free(dataPtr);
    }
}

void Osal_platformSpiCsEnter(void)
{
    while ((CSL_semAcquireDirect (PLATFORM_SPI_HW_SEM)) == 0);
    return;
}
void Osal_platformSpiCsExit (void)
{
    CSL_semReleaseSemaphore (PLATFORM_SPI_HW_SEM);
    return;
}

uint32_t convert_CoreLocal2GlobalAddr (uint32_t addr)
{
    uint32_t coreNum;
    coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
    return ((1 << 28) | (coreNum << 24) | (addr & 0x00ffffff));
}
void EVM_init()
{
    platform_init_flags sFlags;
    platform_init_config sConfig;
    int32_t pform_status;

    platform_uart_init();
    platform_uart_set_baudrate(115200);
    (void) platform_write_configure(PLATFORM_WRITE_ALL);
    memset( (void *) &sFlags, 0, sizeof(platform_init_flags));
    memset( (void *) &sConfig, 0, sizeof(platform_init_config));

    sFlags.pll = 0; /* PLLs for clocking */
    sFlags.ddr = 0; /* External memory */
    //sFlags.tcsl = 1; /* Time stamp counter */
    sFlags.phy = 0; /* Ethernet */
    sFlags.ecc = 0; /* Memory ECC */
    sConfig.pllm = 0; /* Use libraries default clock divisor */
    pform_status = platform_init(&sFlags, &sConfig);

    if (pform_status != Platform_EOK)
    {
        platform_write("Platform failed to initialize. Error code %d \n", pform_status);
        platform_write("We will die in an infinite loop... \n");
        while (1)
        {
            (void) platform_led(1, PLATFORM_LED_ON, PLATFORM_USER_LED_CLASS);
            (void) platform_delay(50000);
            (void) platform_led(1, PLATFORM_LED_OFF, PLATFORM_USER_LED_CLASS);
            (void) platform_delay(50000);
        }
    }
    return;
}

Void my_print_status_for_Notify_sendEvent(Int status)
{
    switch(status)
    {
    case Notify_E_EVTNOTREGISTERED :
        platform_write("event has no registered callback \n");
        break;
    case Notify_E_NOTINITIALIZED :
        platform_write("remote driver has not yet been initialized \n");
        break;
    case Notify_E_EVTDISABLED :
        platform_write("remote event is disabled \n");
        break;
    case Notify_E_TIMEOUT :
        platform_write("timeout occurred (when waitClear is TRUE) \n");
        break;
    case Notify_S_SUCCESS :
        platform_write(" event successfully sent \n");
        break;
    default :
        platform_write(" What? \n");
        break;
    }
}


EVM_init.h