I have the similar issue. Clock_getTicks() is slower than regular time, about 3/4 slower. I am running on MSP430F5438A board.
The configuration:
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
Timer.anyMask = 6;
Clock.tickSource = Clock.TickSource_USER;
Clock.tickMode = Clock.TickMode_PERIODIC;
Clock.timerId = 0;
Clock.tickPeriod = 1000; // 1ms
The full cfg file is here.
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 SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');
var Hwi = xdc.useModule('ti.sysbios.family.msp430.Hwi');
var Memory = xdc.useModule('xdc.runtime.Memory');
var Timer = xdc.useModule('ti.sysbios.family.msp430.Timer');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Event = xdc.useModule('ti.sysbios.knl.Event');
var GateMutexPri = xdc.useModule('ti.sysbios.gates.GateMutexPri');
var Assert = xdc.useModule('xdc.runtime.Assert');
var TimestampStd = xdc.useModule('xdc.runtime.TimestampStd');
var GateTask = xdc.useModule('ti.sysbios.gates.GateTask');
/*
* Program.argSize sets the size of the .args section.
* The examples don't use command line args so argSize is set to 0.
*/
Program.argSize = 0x0;
/*
* Uncomment this line to globally disable Asserts.
* All modules inherit the default from the 'Defaults' module. You
* can override these defaults on a per-module basis using Module.common$.
* Disabling Asserts will save code space and improve runtime performance.
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
*/
/*
* Uncomment this line to keep module names from being loaded on the target.
* The module name strings are placed in the .const section. Setting this
* parameter to false will save space in the .const section. Error and
* Assert messages will contain an "unknown module" prefix instead
* of the actual module name.
Defaults.common$.namedModule = false;
*/
/*
* Comment this line out if you want to dynamically create instance
* objects.
*/
Defaults.common$.memoryPolicy = xdc.module("xdc.runtime.Types").DELETE_POLICY;
/*
* Minimize exit handler array in System. The System module includes
* an array of functions that are registered with System_atexit() to be
* called by System_exit().
*/
System.maxAtexitHandlers = 4;
/*
* Uncomment this line to disable the Error print function.
* We lose error information when this is disabled since the errors are
* not printed. Disabling the raiseHook will save some code space if
* your app is not using System_printf() since the Error_print() function
* calls System_printf().
Error.raiseHook = null;
*/
/*
* Uncomment this line to keep Error, Assert, and Log strings from being
* loaded on the target. These strings are placed in the .const section.
* Setting this parameter to false will save space in the .const section.
* Error, Assert and Log message will print raw ids and args instead of
* a formatted message.
Text.isLoaded = false;
*/
/*
* Uncomment this line to disable the output of characters by SysMin
* when the program exits. SysMin writes characters to a circular buffer.
* This buffer can be viewed using the SysMin Output view in ROV.
SysMin.flushAtExit = false;
*/
/*
* Use SysMin for output (System_printf() and error messages) and
* minimize the output buffer size to save data space.
*/
System.SupportProxy = SysMin;
SysMin.bufSize = 80;
/*
* Create a LoggerBuf and make it the default logger for all modules.
*/
var LoggerBufParams = new LoggerBuf.Params();
LoggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(LoggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;
/* System stack size (used by ISRs and Swis) */
Program.stack = 0x200;
/*
* Application specific configuration
*/
var Boot = xdc.useModule('ti.catalog.msp430.init.Boot');
Boot.configureDCO = false;
/*
* Disable unused BIOS features to minimize footprint.
* This example uses Tasks but not Swis or Clocks.
*/
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.swiEnabled = true;
BIOS.taskEnabled = true;
BIOS.clockEnabled = true;
/* Minimize system heap */
BIOS.heapSize = 0;
/* Use Custom BIOS lib to achieve minimal footprint */
BIOS.libType = BIOS.LibType_Custom;
/* Create a task with priority 1 */
var Task = xdc.useModule('ti.sysbios.knl.Task');
/* Inhibit the creation of a task to run idle functions */
Task.enableIdleTask = false;
/* Allow SYS/BIOS to idle the CPU while waiting for an interrupt */
var Power = xdc.useModule('ti.sysbios.family.msp430.Power');
/*
* Create a binary semaphore for the timer ISR to use to
* signal the pended task every 10 ticks
*/
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
/*
* Build a custom BIOS library. The custom library will be smaller than the
* pre-built "instrumented" (default) and "non-instrumented" libraries.
*
* The BIOS.logsEnabled parameter specifies whether the Logging is enabled
* within BIOS for this custom build. These logs are used by the RTA and
* UIA analysis tools.
*
* The BIOS.assertsEnabled parameter specifies whether BIOS code will
* include Assert() checks. Setting this parameter to 'false' will generate
* smaller and faster code, but having asserts enabled is recommended for
* early development as the Assert() checks will catch lots of programming
* errors (invalid parameters, etc.)
*/
BIOS.libType = BIOS.LibType_Custom;
BIOS.logsEnabled = false;
BIOS.assertsEnabled = true;
BIOS.cpuFreq.lo = 25000000;
Hwi.dispatcherAutoNestingSupport = false;
Task.numPriorities = 8;
var CartStatesTaskTaskParams = new Task.Params();
CartStatesTaskTaskParams.priority = 3;
CartStatesTaskTaskParams.stackSize = 800;
var CartStatesTask = Task.create("&CartStatesTask", CartStatesTaskTaskParams);
var BlockForeverParams = new Semaphore.Params();
BlockForeverParams.instance.name = "BlockForever";
BlockForeverParams.mode = Semaphore.Mode_BINARY;
Program.global.BlockForever = Semaphore.create(null, BlockForeverParams);
Timer.anyMask = 6;
Clock.tickSource = Clock.TickSource_USER;
Clock.tickMode = Clock.TickMode_PERIODIC;
Clock.timerId = 0;
Clock.tickPeriod = 1000;
var WatchdogTaskParams = new Task.Params();
WatchdogTaskParams.instance.name = "null";
WatchdogTaskParams.priority = 7;
WatchdogTaskParams.stackSize = 800;
var WatchdogTask = Task.create("&WatchdogTask", WatchdogTaskParams);
var PwrGoodInput_EvParams = new Event.Params();
Task.common$.namedInstance = true;
var I2CMaster_mtxParams = new GateMutexPri.Params();
I2CMaster_mtxParams.instance.name = "I2CMaster_mtx";
Program.global.I2CMaster_mtx = GateMutexPri.create(I2CMaster_mtxParams);
/*
*CMD task
*/
var CmdParserTask_EvParams = new Event.Params();
CmdParserTask_EvParams.instance.name = "CMD_PARSER_TASK_EV";
Program.global.CMD_PARSER_TASK_EV = Event.create(CmdParserTask_EvParams);
Error.raiseHook = BIOS.errorRaiseHook;
var I2C_EVParams = new Event.Params();
I2C_EVParams.instance.name = "I2C_EV";
Program.global.I2C_EV = Event.create(I2C_EVParams);
var SYS_FLAG_EVParams = new Event.Params();
SYS_FLAG_EVParams.instance.name = "SYS_FLAG_EV";
Program.global.SYS_FLAG_EV = Event.create(SYS_FLAG_EVParams);
var POWER_CHARGE_EVParams = new Event.Params();
POWER_CHARGE_EVParams.instance.name = "POWER_CHARGE_EV";
Program.global.POWER_CHARGE_EV = Event.create(POWER_CHARGE_EVParams);
var ADC_conversionParams = new Hwi.Params();
ADC_conversionParams.instance.name = "ADC_Conversion";
Program.global.ADC_Conversion = Hwi.create(55, "&ADC_conversion_ISR", ADC_conversionParams);
// I2C
var i2c_desc_q_semParams = new Semaphore.Params();
i2c_desc_q_semParams.instance.name = "i2c_desc_q_sem";
Program.global.i2c_desc_q_sem = Semaphore.create(1, i2c_desc_q_semParams);
var i2c_io_completion_semaParams = new Semaphore.Params();
i2c_io_completion_semaParams.instance.name = "i2c_io_completion_sema";
i2c_io_completion_semaParams.mode = Semaphore.Mode_BINARY;
Program.global.i2c_io_completion_sema = Semaphore.create(null, i2c_io_completion_semaParams);
var USCI_B0_ISRParams = new Hwi.Params();
USCI_B0_ISRParams.instance.name = "I2C_Master";
USCI_B0_ISRParams.enableInt = false;
USCI_B0_ISRParams.swiEnabled = false;
USCI_B0_ISRParams.keepAwakeEnabled = true;
Program.global.I2C_Master = Hwi.create(56, "&USCI_B0_ISR", USCI_B0_ISRParams);
/*
*i2c task
*/
var i2c_taskParams = new Task.Params();
i2c_taskParams.instance.name = "null";
i2c_taskParams.stackSize = 800;
i2c_taskParams.priority = 1;
var i2c_task = Task.create("&i2c_task", i2c_taskParams);
var i2c_task_evtParams = new Event.Params();
i2c_task_evtParams.instance.name = "i2c_task_evt";
Program.global.i2c_task_evt = Event.create(i2c_task_evtParams);
var spitaskParams = new Task.Params();
spitaskParams.instance.name = "null";
spitaskParams.priority = 5;
spitaskParams.stackSize = 800;
var spitask = Task.create("&SPICmdParserTask", spitaskParams);
var SPI_Slave_SSN_n_InterlocksParams = new Hwi.Params();
SPI_Slave_SSN_n_InterlocksParams.instance.name = "SPI_Slave_SSN_n_Interlocks";
SPI_Slave_SSN_n_InterlocksParams.swiEnabled = false;
SPI_Slave_SSN_n_InterlocksParams.enableInt = false;
Program.global.SPI_Slave_SSN_n_Interlocks = Hwi.create(47, "&Port1_ISR", SPI_Slave_SSN_n_InterlocksParams);
var Host_Spi_DMAParams = new Hwi.Params();
Host_Spi_DMAParams.instance.name = "Host_Spi_DMA_ISR";
Host_Spi_DMAParams.swiEnabled = false;
Host_Spi_DMAParams.enableInt = false;
Program.global.Host_Spi_DMA_ISR = Hwi.create(50, "&Host_spi_dma_isr", Host_Spi_DMAParams);
var task4Params = new Task.Params();
task4Params.instance.name = "null";
task4Params.priority = 4;
task4Params.stackSize = 800;
var Sensor = Task.create("&SensorTask", task4Params);
var ThermalTask_EvParams = new Event.Params();
ThermalTask_EvParams.instance.name = "SensorTask_Ev";
Program.global.SensorTask_Ev = Event.create(ThermalTask_EvParams);
var hwi5Params = new Hwi.Params();
hwi5Params.instance.name = "HDQ_timer_isr";
Program.global.HDQ_timer_isr = Hwi.create(48, "&Timer_A1_CCR2_ISR", hwi5Params);
var HDQ_EvParams = new Event.Params();
HDQ_EvParams.instance.name = "hdq_io_evt";
Program.global.hdq_io_evt = Event.create(HDQ_EvParams);
var ChargerTaskParams = new Task.Params();
ChargerTaskParams.instance.name = "null";
ChargerTaskParams.priority = 2;
ChargerTaskParams.stackSize = 800;
var ChargerTask = Task.create("&ChargerTask", ChargerTaskParams);
var ADCReadParams = new GateMutexPri.Params();
ADCReadParams.instance.name = "SensorsUpdateMtx";
Program.global.SensorsUpdateMtx = GateMutexPri.create(ADCReadParams);
var ADCEvtParams = new Event.Params();
ADCEvtParams.instance.name = "ADCEvt";
Program.global.ADCEvt = Event.create(ADCEvtParams);
var ClockTickParams = new Hwi.Params();
ClockTickParams.instance.name = "ClockTick";
Program.global.ClockTick = Hwi.create(54, "&OnClockTick", ClockTickParams);
var ModuleStatus_evtParams = new Event.Params();
ModuleStatus_evtParams.instance.name = "ModuleStatus_evt";
Program.global.ModuleStatus_evt = Event.create(ModuleStatus_evtParams);
Clock.swiPriority = 15;
var gateTaskAppLogParams = new GateTask.Params();
gateTaskAppLogParams.instance.name = "gGateTaskAppLog";
Program.global.gGateTaskAppLog = GateTask.create(gateTaskAppLogParams);