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.

TMS320C6670: qmInfraMCExample - change cores synchronization from queues to IPC

Part Number: TMS320C6670

Hi,

Based on qmInfraMCExample I'm trying to do both directional communication beetween cores. I've done both directional communictaion core 0 to core 1, but when I want to send few packets of data I have problem.

If I send one packet to each core sequentially, that is ok. When I send two packets to one core is the problem.

When I'm trying to program the high priority accumulator for the same channel I cannot do this. I have to wait till receive core disable the accumulator. I cannot second time program accumulator for the same channel. Core 0 will send packets to core 1 and 2, so I have to program accumulator every time.

I thought I'd use semaphore and notifiy. On core 0 after send packet I'll pend semaphore, so program in core 0 will be wait. Core 1 after received packet will disable accumulator and send notify to core 0. This notify will post semaphore on core 0 and core 0 will be able to send another packet.

To using notify I must use ipc. I did cores synchronization using queue. Now I want to use only IPC to synchronize all cores. I added variables to cfg file, but something with memory is not ok. I know that something is not ok with part of code that I added, because when I comment Ipc_start() function, program starts and works ok.

Below is may cfg file:

var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');

/* 
 *  Get the list of names that the build device supports.
 *  I.e. ["CORE0", "CORE1", "CORE2" ... ]
 */
var nameList = MultiProc.getDeviceProcNames();

/* 
 *  Since this is a single-image example, we don't (at build-time) which 
 *  processor we're building for.  We therefore supply 'null' 
 *  as the local procName and use MultiProc_setLocalId to set the procId
 *  at runtime.
 */
MultiProc.setConfig(null, nameList);

var Memory = xdc.useModule('xdc.runtime.Memory');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Idle = xdc.useModule('ti.sysbios.knl.Idle');
var Timestamp = xdc.useModule('xdc.runtime.Timestamp');
var Notify = xdc.useModule('ti.sdo.ipc.Notify');

/* Load and use the CPPI and QMSS packages */
var Cppi = xdc.loadPackage('ti.drv.cppi'); 
var Qmss = xdc.loadPackage('ti.drv.qmss'); 

Program.sectMap[".qmss"] = new Program.SectionSpec();
Program.sectMap[".qmss"] = "MSMCSRAM";

Program.sectMap[".cppi"] = new Program.SectionSpec();
Program.sectMap[".cppi"] = "L2SRAM";

Program.sectMap[".csl_vect"] = new Program.SectionSpec();
Program.sectMap[".csl_vect"] = "L2SRAM";

Program.sectMap[".init_array"] = new Program.SectionSpec();
Program.sectMap[".init_array"] = "L2SRAM";

/* Use the CSL module and indicate that INTC library will be used. */
var cslSettings = xdc.useModule ('ti.csl.Settings');
cslSettings.useCSLIntcLib = true;

var System = xdc.useModule('xdc.runtime.System');
var SysStd  = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;

/* Create a default system heap using ti.bios.HeapMem. */
var heapMemParams1         = new HeapMem.Params;
heapMemParams1.size        = 12288;
heapMemParams1.sectionName = "systemHeap";
Program.global.heap0       = HeapMem.create(heapMemParams1);

/* This is the default memory heap. */
Memory.defaultHeapInstance = Program.global.heap0;

Program.sectMap["systemHeap"] = Program.platform.stackMemory;

var heapMemParams2 = new HeapMem.Params;
heapMemParams2.size = 16384;
heapMemParams2.align = 8;
heapMemParams2.sectionName = "cppiSharedHeap";
Program.global.cppiSharedHeap = HeapMem.create(heapMemParams2);

//Program.sectMap["cppiSharedHeap"] = new Program.SectionSpec();
Program.sectMap["cppiSharedHeap"] = "MSMCSRAM";
 
 // set default diags mask
var Diags = xdc.useModule('xdc.runtime.Diags');
var Defaults = xdc.useModule('xdc.runtime.Defaults');

Defaults.common$.diags_ENTRY     = Diags.ALWAYS_OFF;
Defaults.common$.diags_EXIT      = Diags.ALWAYS_OFF;
Defaults.common$.diags_LIFECYCLE = Diags.ALWAYS_OFF;
Defaults.common$.diags_INTERNAL  = Diags.ALWAYS_OFF;  /* needed for asserts */
Defaults.common$.diags_ASSERT    = Diags.ALWAYS_OFF;  /* development only   */
Defaults.common$.diags_STATUS    = Diags.RUNTIME_ON;
Defaults.common$.diags_USER1     = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER2     = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER3     = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER4     = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER5     = Diags.ALWAYS_OFF;
Defaults.common$.diags_USER6     = Diags.ALWAYS_OFF;
Defaults.common$.diags_INFO      = Diags.ALWAYS_OFF;
Defaults.common$.diags_ANALYSIS  = Diags.ALWAYS_OFF;

// override diags mask for selected modules
xdc.useModule('xdc.runtime.Main');
Diags.setMaskMeta(
    "xdc.runtime.Main",
    Diags.ENTRY | Diags.EXIT | Diags.INFO,
    Diags.RUNTIME_ON
);

var Registry = xdc.useModule('xdc.runtime.Registry');
Registry.common$.diags_ENTRY = Diags.RUNTIME_OFF;
Registry.common$.diags_EXIT  = Diags.RUNTIME_OFF;
Registry.common$.diags_INFO  = Diags.RUNTIME_OFF;
Registry.common$.diags_USER1 = Diags.RUNTIME_OFF;

// create a logger instance
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var loggerBuf0Params = new LoggerBuf.Params();
loggerBuf0Params.numEntries = 1000;
loggerBuf0Params.bufType = LoggerBuf.BufType_CIRCULAR;
var loggerBuf0 = LoggerBuf.create(loggerBuf0Params);
Defaults.common$.logger = loggerBuf0;

// configure SysBios clock
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
Clock.tickPeriod = 100;
Clock.timerId = 1;

// Synchronize all processors (this will be done in Ipc_start)
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
Ipc.procSync = Ipc.ProcSync_ALL;

/* To avoid wasting shared memory for MessageQ transports */
for (var i = 0; i < MultiProc.numProcessors; i++) {
    Ipc.setEntryMeta({
        remoteProcId: i,
        setupMessageQ: false,
    });
}

/* Shared Memory base address and length */
var SHAREDMEM           = 0x80000000;
var SHAREDMEMSIZE       = 0x00010000;

/* 
 *  Need to define the shared region. The IPC modules use this
 *  to make portable pointers. All processors need to add this
 *  call with their base address of the shared memory region.
 *  If the processor cannot access the memory, do not add it.
 */ 
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
SharedRegion.setEntryMeta(0,
    { base: SHAREDMEM, 
      len:  SHAREDMEMSIZE,
      ownerProcId: 0,
      isValid: true,
      name: "SR0",
    });
    

In attachment is my board Platform.xdc file.

TMS320C6670_board.zip

Can anybody tell me what is wrong? Do I need Shared Region to use IPC only for cores synchronization and using notify?

I've added followed code to cfg file:

var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');

/* 
 *  Get the list of names that the build device supports.
 *  I.e. ["CORE0", "CORE1", "CORE2" ... ]
 */
var nameList = MultiProc.getDeviceProcNames();

/* 
 *  Since this is a single-image example, we don't (at build-time) which 
 *  processor we're building for.  We therefore supply 'null' 
 *  as the local procName and use MultiProc_setLocalId to set the procId
 *  at runtime.
 */
MultiProc.setConfig(null, nameList);

// Synchronize all processors (this will be done in Ipc_start)
var Ipc = xdc.useModule('ti.sdo.ipc.Ipc');
Ipc.procSync = Ipc.ProcSync_ALL;

/* To avoid wasting shared memory for MessageQ transports */
for (var i = 0; i < MultiProc.numProcessors; i++) {
    Ipc.setEntryMeta({
        remoteProcId: i,
        setupMessageQ: false,
    });
}

/* Shared Memory base address and length */
var SHAREDMEM           = 0x80000000;
var SHAREDMEMSIZE       = 0x00010000;

/* 
 *  Need to define the shared region. The IPC modules use this
 *  to make portable pointers. All processors need to add this
 *  call with their base address of the shared memory region.
 *  If the processor cannot access the memory, do not add it.
 */ 
var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion');
SharedRegion.setEntryMeta(0,
    { base: SHAREDMEM, 
      len:  SHAREDMEMSIZE,
      ownerProcId: 0,
      isValid: true,
      name: "SR0",
    });

Mayby exist better sollution to solve my problem with accumulator. I have to measure latency and throughput between cores. Next I'd like to use QPEND mode. I've read that QPEND mode would be faster than Accumulator mode.

Thanks.

Lukasz.