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.

Debugging queue and semaphore

Other Parts Discussed in Thread: SYSBIOS

Hi,

I'm having problem with a task getting blocked while it should be fed continously by by a periodic clock posting message in its queue.

The function associated to the clocks runs only for a few iterations and is never executed after.

Do you have suggestion on how to effectively  debug this issue? Any document that could be helpful also to debug queue and semaphore?

What could cause the a periodic clock to stop running?

Thanks

  • Hi, 

    After doing more debugging I found two interesting things. 

    The periodixc function is started here:

    #define TICK_PERIOD 10

    void Tick_initTick( void )
    {
    mEncoderCount = mLastEncoderCount = mPrevEncoderCount = 0;
    mTickCount = mLastTickCount = 0;

    swdrv_init();
    swdrv_startSwIrq();
    init_switches();

    cnt100ms = 10; // Internal Tick Handler called every 10ms
    cnt1sec = 10;
    tempcnt_timer = 1;
    mTick_up_time = 0;

    // Set up one shot Quad Irq SWI handler
    Util_constructClock(&_quadClock, Tick_quadHandler, QUAD_HANDLER_DELAY, 0, false, 0);
    // Start 'a tickin' every 10ms
    Util_constructClock(&_tickClock, Tick_clockHandler, 0, TICK_PERIOD, true, 0);
    }

    • if I set tick mode "every period" the function Tick_clockHandler associated to the tick clock never executes. I can see putting breakpoints in the code that tRemaining goes from 0 to un unreasonable number making me think about some memory issues 

    • If I set tick mode "dynamic mode" it does a few iterations and stops showing this: 

    Any help is appreciated.

    Thanks

    Paolo 

  • 1) Which version of TI-RTOS are you using?
    2) Can you share your Tick_clockHandler() function? How is it "posting messages in its queue"?
    3) Please share more info about the Util_constructClock() function. Where is the _tickClock object defined? Where did the"ti.sy..." clock object label shown in the ROV view come from?
    4) Have you modified the default Clock.tickPeriod in your .cfg file?

    Alan
  • Hi Alan,

    thanks for the quick reply.

    1) 2.16.0.08

    2) Sure: 

    tatic void Tick_clockHandler( UArg arg )

    {

    Result_t ret;

    // Timing, LED blinking & switch debouncing ***TBD

    // Switch debouncing

    debounce_switch(&mKnobSw_state);

    cnt100ms = cnt100ms - 1;

    // Update timers

    if( cnt100ms == 0 )

    {

    cnt100ms = 10;

    //ret = Util_send_to_queue( gTickUIOutputQueue, TickEventMsgIDs_100MS, 0, 1, 0 );

    if (mPrevEncoderCount != mEncoderCount)

    {

    ret = Util_send_to_queue( gTickUIOutputQueue, TickEventMsgIDs_QUAD_CHANGE, 0,

    (uint32_t) (mEncoderCount - mPrevEncoderCount), 0);

    if (ret == RESULT_SUCCESS)

    {

    // keep accumulating if this fails

    mPrevEncoderCount = mEncoderCount;

    }

    }

    if (--cnt1sec == 0)

    {

    cnt1sec = 10;

    // Update 1s Up time counter

    mTick_up_time++;

    // Send 1 sec Tick Event

    ret = Util_send_to_queue( gTickUIOutputQueue, TickEventMsgIDs_1SEC, 0, 1, 0 );

    // Note, if this fails, we could accumulate 1 sec tick events... naw...

    }

    }

    // Temp Control Task Timer

    if (gTickTempOutputQueue != NULL)

    {

    if (--tempcnt_timer == 0)

    {

    tempcnt_timer = gTickTempTimerPeriod;

    ret = Util_send_to_queue( gTickTempOutputQueue,TickEventMsgIDs_TEMP_TIMER, 0, 1, 0 );

    // Note, if this fails, we could accumulate timer events... naw...

    }

    }

    }

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

     

    3) It's defined as:

    static Clock_Struct _tickClock;

    inside the same .c file containing the handler function.

    The two ti.sys voices are  ti.sysbios.knl.Clock@36de and ti.sysbios.knl.Clock@37a4. Pasting below the module tab

    4) This is the .cfg file:

    /*

    * Copyright (c) 2015-2016, Texas Instruments Incorporated

    * All rights reserved.

    *

    * Redistribution and use in source and binary forms, with or without

    * modification, are permitted provided that the following conditions

    * are met:

    *

    * *  Redistributions of source code must retain the above copyright

    *    notice, this list of conditions and the following disclaimer.

    *

    * *  Redistributions in binary form must reproduce the above copyright

    *    notice, this list of conditions and the following disclaimer in the

    *    documentation and/or other materials provided with the distribution.

    *

    * *  Neither the name of Texas Instruments Incorporated nor the names of

    *    its contributors may be used to endorse or promote products derived

    *    from this software without specific prior written permission.

    *

    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"

    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,

    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR

    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR

    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,

    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,

    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;

    * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,

    * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR

    * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,

    * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    */

    /* ================ Boot configuration ================ */

    var Boot = xdc.useModule('ti.catalog.msp430.init.Boot');

    /*

    * The Boot module supports boot initialization for the MSP430 devices.

    * A special boot init function is created based on the configuration

    * settings for this module.

    */

    /* ================ Clock configuration ================ */

    var Clock = xdc.useModule('ti.sysbios.knl.Clock');

    var ti_sysbios_family_msp430_Hwi = xdc.useModule('ti.sysbios.family.msp430.Hwi');

    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');

    /*

    * The timer used by the Clock module supports TickMode_DYNAMIC. This enables us

    * to set the tick period to 1000 us without generating the overhead of additional

    * interrupts.

    */

    Clock.tickPeriod = 10;

    /* ================ Defaults (module) configuration ================ */

    var Defaults = xdc.useModule('xdc.runtime.Defaults');

    /*

    * A flag to allow module names to be loaded on the target. Module name

    * strings are placed in the .const section for debugging purposes.

    *

    * Pick one:

    *  - true (default)

    *      Setting this parameter to true will include name strings in the .const

    *      section so that Errors and Asserts are easier to debug.

    *  - false

    *      Setting this parameter to false will reduce footprint in the .const

    *      section. As a result, Error and Assert messages will contain an

    *      "unknown module" prefix instead of the actual module name.

    */

    //Defaults.common$.namedModule = true;

    Defaults.common$.namedModule = false;

    /* ================ Error configuration ================ */

    var Error = xdc.useModule('xdc.runtime.Error');

    /*

    * This function is called to handle all raised errors, but unlike

    * Error.raiseHook, this function is responsible for completely handling the

    * error with an appropriately initialized Error_Block.

    *

    * Pick one:

    *  - Error.policyDefault (default)

    *      Calls Error.raiseHook with an initialized Error_Block structure and logs

    *      the error using the module's logger.

    *  - Error.policySpin

    *      Simple alternative that traps on a while(1) loop for minimized target

    *      footprint.

    *      Using Error.policySpin, the Error.raiseHook will NOT called.

    */

    //Error.policyFxn = Error.policyDefault;

    Error.policyFxn = Error.policySpin;

    /*

    * If Error.policyFxn is set to Error.policyDefault, this function is called

    * whenever an error is raised by the Error module.

    *

    * Pick one:

    *  - Error.print (default)

    *      Errors are formatted and output via System_printf() for easier

    *      debugging.

    *  - null

    *      Errors are not formatted or logged. This option reduces code footprint.

    *  - non-null function

    *      Errors invoke custom user function. See the Error module documentation

    *      for more details.

    */

    //Error.raiseHook = Error.print;

    Error.raiseHook = null;

    //Error.raiseHook = "&myErrorFxn";

    /*

    * If Error.policyFxn is set to Error.policyDefault, this option applies to the

    * maximum number of times the Error.raiseHook function can be recursively

    * invoked. This option limits the possibility of an infinite recursion that

    * could lead to a stack overflow.

    * The default value is 16.

    */

    Error.maxDepth = 2;

    /* ================ Hwi configuration ================ */

    //var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

    //var msp430Hwi = xdc.useModule('ti.sysbios.family.msp430.Hwi');

    /*

    * Checks for Hwi (system) stack overruns while in the Idle loop.

    *

    * Pick one:

    *  - true (default)

    *      Checks the top word for system stack overflows during the idle loop and

    *      raises an Error if one is detected.

    *  - false

    *      Disabling the runtime check improves runtime performance and yields a

    *      reduced flash footprint.

    */

    //Hwi.checkStackFlag = true;

    //halHwi.checkStackFlag = false;

    /* ================ Hwi configuration ================ */

    /*

    * All Hwis for MSP430 must be created statically; including Hwis for TI-RTOS

    * drivers

    */

    //var hwi0Params = new Hwi.Params();

    //hwi0Params.instance.name = "I2C_hwi";

    //hwi0Params.arg = 0;

    //Program.global.hwi0 = Hwi.create(55, "&I2CUSCIB_hwiIntFxn", hwi0Params);

    //var hwi1Params = new Hwi.Params();

    //hwi1Params.instance.name = "spi_dma_hwi";

    //hwi1Params.arg = 0;

    //Program.global.hwi1 = Hwi.create(50, "&MSP_EXP430F5529LP_isrDMA", hwi1Params); //SPIUSCIADMA_hwiIntFxn

    //hwi0Params.instance.name = "hwi2";

    //hwi0Params.arg = 0;

    //Program.global.hwi2 = Hwi.create(46, "&UARTEUSCIA_hwiIntFxn", hwi0Params);

    //var hwi3Params = new Hwi.Params();

    //hwi3Params.instance.name = "hwi3";

    //hwi3Params.arg = 0;

    //Program.global.hwi3 = Hwi.create(42, "&GPIO_hwiIntFxn", hwi3Params); //revise the port

    /* ================ Idle configuration ================ */

    var Idle = xdc.useModule('ti.sysbios.knl.Idle');

    /*

    * The Idle module is used to specify a list of functions to be called when no

    * other tasks are running in the system.

    *

    * Functions added here will be run continuously within the idle task.

    *

    * Function signature:

    *     Void func(Void);

    */

    //Idle.addFunc("&myIdleFunc");

    /* ================ Kernel (SYS/BIOS) configuration ================ */

    var BIOS = xdc.useModule('ti.sysbios.BIOS');

    /*

    * Enable asserts in the BIOS library.

    *

    * Pick one:

    *  - true (default)

    *      Enables asserts for debugging purposes.

    *  - false

    *      Disables asserts for a reduced code footprint and better performance.

    */

    //BIOS.assertsEnabled = true;

    BIOS.assertsEnabled = false;

    /* Set the default CPU frequency */

    BIOS.cpuFreq.lo = 25000000;

    /*

    * Specify default heap size for BIOS.

    */

    BIOS.heapSize = 1024;

    /*

    * A flag to determine if xdc.runtime sources are to be included in a custom

    * built BIOS library.

    *

    * Pick one:

    *  - false (default)

    *      The pre-built xdc.runtime library is provided by the respective target

    *      used to build the application.

    *  - true

    *      xdc.runtime library sources are to be included in the custom BIOS

    *      library. This option yields the most efficient library in both code

    *      footprint and runtime performance.

    */

    BIOS.includeXdcRuntime = true;

    //BIOS.includeXdcRuntime = true;

    /*

    * The SYS/BIOS runtime is provided in the form of a library that is linked

    * with the application. Several forms of this library are provided with the

    * SYS/BIOS product.

    *

    * Pick one:

    *   - BIOS.LibType_Custom

    *      Custom built library that is highly optimized for code footprint and

    *      runtime performance.

    *   - BIOS.LibType_Debug

    *      Custom built library that is non-optimized that can be used to

    *      single-step through APIs with a debugger.

    *

    */

    BIOS.libType = BIOS.LibType_Debug;

    //BIOS.libType = BIOS.LibType_Debug;

    /*

    * Runtime instance creation enable flag.

    *

    * Pick one:

    *   - true (default)

    *      Allows Mod_create() and Mod_delete() to be called at runtime which

    *      requires a default heap for dynamic memory allocation.

    *   - false

    *      Reduces code footprint by disallowing Mod_create() and Mod_delete() to

    *      be called at runtime. Object instances are constructed via

    *      Mod_construct() and destructed via Mod_destruct().

    */

    BIOS.runtimeCreatesEnabled = true;

    //BIOS.runtimeCreatesEnabled = false;

    /*

    * Enable logs in the BIOS library.

    *

    * Pick one:

    *  - true (default)

    *      Enables logs for debugging purposes.

    *  - false

    *      Disables logging for reduced code footprint and improved runtime

    *      performance.

    */

    //BIOS.logsEnabled = true;

    BIOS.logsEnabled = false;

    /* ================ Memory configuration ================ */

    var Memory = xdc.useModule('xdc.runtime.Memory');

    /*

    * The Memory module itself simply provides a common interface for any

    * variety of system and application specific memory management policies

    * implemented by the IHeap modules(Ex. HeapMem, HeapBuf).

    */

    /* ================ Power configuration ================ */

    var Power = xdc.useModule('ti.sysbios.family.msp430.Power');

    /*

    * Dynamically change idle mode power settings.

    *

    * Pick one:

    *  - true

    *      Allow for dynamic waking of the CPU when returning

    *      from an interrupt at runtime.

    *  - false (default)

    *      Disable run-time checking of this parameter; Yields a

    *      small code saving.

    */

    //Power.allowDynamicMode = true;

    /*

    * Behavior of the power module when the system enters the idle loop.

    *

    * Pick one:

    *  - false (default)

    *      Disables power savings and ignores the power policy function.

    *  - true

    *      The power module inserts a power policy function into the idle loop

    *      where it will take action to save power until the next CPU interrupt

    *      occurs. This option can cause the debugger to be disconnected from the

    *      target.

    */

    Power.idle = false;

    //Power.idle = true;

    /*

    * These options only apply if Power.idle is set to true. The Power.idleMode

    * parameter determines the system's behavior when it enters the idle loop.

    *

    * Pick one:

    *  - Power.LPM0 (default)

    *  - Power.LPM1

    *  - Power.LPM2

    *  - Power.LPM3

    *  - Power.LPM4

    *    See the Operating Modes section of the respective

    *    MSP430's User Guide for a detailed explanation of these modes.

    */

    //Power.idleMode = Power.LPM0;

    //Power.idleMode = Power.LPM1;

    //Power.idleMode = Power.LPM2;

    //Power.idleMode = Power.LPM3;

    //Power.idleMode = Power.LPM4;

    /* conf from 2640 */

    Power.allowDynamicMode = false;

    //Power.policyFunc = Power.standbyPolicy; //  changed from C2640

    //Power.calibrateRCOSC = true;

    /* ================ Program configuration ================ */

    /*

    *  Program.stack is ignored with IAR. Use the project options in

    *  IAR Embedded Workbench to alter the system stack size.

    */

    if (!Program.build.target.$name.match(/iar/)) {

       /*

        *  Reducing the system stack size (used by ISRs and Swis) to reduce

        *  RAM usage.

        */

       Program.stack = 1024;

    }

    /*

    * Enable Semihosting for GNU targets to print to CCS console

    */

    if (Program.build.target.$name.match(/gnu/)) {

    }

    /* ================ Semaphore configuration ================ */

    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');

    /*

    * Enables global support for Task priority pend queuing.

    *

    * Pick one:

    *  - true (default)

    *      This allows pending tasks to be serviced based on their task priority.

    *  - false

    *      Pending tasks are services based on first in, first out basis.

    *

    *  When using BIOS in ROM:

    *      This option must be set to false.

    */

    //Semaphore.supportsPriority = true;

    Semaphore.supportsPriority = true;

    /*

    * Allows for the implicit posting of events through the semaphore,

    * disable for additional code saving.

    *

    * Pick one:

    *  - true

    *      This allows the Semaphore module to post semaphores and events

    *      simultaneously.

    *  - false (default)

    *      Events must be explicitly posted to unblock tasks.

    *

    */

    //Semaphore.supportsEvents = true;

    Semaphore.supportsEvents = false;

    /* ================ Swi configuration ================ */

    var Swi = xdc.useModule('ti.sysbios.knl.Swi');

    /*

    * A software interrupt is an object that encapsulates a function to be

    * executed and a priority. Software interrupts are prioritized, preempt tasks

    * and are preempted by hardware interrupt service routines.

    *

    * This module is included to allow Swi's in a users' application.

    */

    /* ================ System configuration ================ */

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

    /*

    * The Abort handler is called when the system exits abnormally.

    *

    * Pick one:

    *  - System.abortStd (default)

    *      Call the ANSI C Standard 'abort()' to terminate the application.

    *  - System.abortSpin

    *      A lightweight abort function that loops indefinitely in a while(1) trap

    *      function.

    *  - A custom abort handler

    *      A user-defined function. See the System module documentation for

    *      details.

    */

    //System.abortFxn = System.abortStd;

    System.abortFxn = System.abortSpin;

    System.extendedFormats = "%f" ;

    //System.abortFxn = "&myAbortSystem";

    /*

    * The Exit handler is called when the system exits normally.

    *

    * Pick one:

    *  - System.exitStd (default)

    *      Call the ANSI C Standard 'exit()' to terminate the application.

    *  - System.exitSpin

    *      A lightweight exit function that loops indefinitely in a while(1) trap

    *      function.

    *  - A custom exit function

    *      A user-defined function. See the System module documentation for

    *      details.

    */

    //System.exitFxn = System.exitStd;

    System.exitFxn = System.exitSpin;

    //System.exitFxn = "&myExitSystem";

    /*

    * Minimize exit handler array in the System module. The System module includes

    * an array of functions that are registered with System_atexit() which is

    * called by System_exit(). The default value is 8.

    */

    System.maxAtexitHandlers = 2;

    /*

    * The System.SupportProxy defines a low-level implementation of System

    * functions such as System_printf(), System_flush(), etc.

    *

    * Pick one pair:

    *  - SysMin

    *      This module maintains an internal configurable circular buffer that

    *      stores the output until System_flush() is called.

    *      The size of the circular buffer is set via SysMin.bufSize.

    *  - SysCallback

    *      SysCallback allows for user-defined implementations for System APIs.

    *      The SysCallback support proxy has a smaller code footprint and can be

    *      used to supply custom System_printf services.

    *      The default SysCallback functions point to stub functions. See the

    *      SysCallback module's documentation.

    */

    var SysMin = xdc.useModule('xdc.runtime.SysMin');

    SysMin.bufSize = 128;

    System.SupportProxy = SysMin;

    //var SysCallback = xdc.useModule('xdc.runtime.SysCallback');

    //var xdc_runtime_SysCallback = xdc.useModule('xdc.runtime.SysCallback');

    //SysCallback.abortFxn = "&myUserAbort";

    //SysCallback.exitFxn  = "&myUserExit";

    //SysCallback.flushFxn = "&myUserFlush";

    //SysCallback.putchFxn = "&myUserPutch";

    //SysCallback.readyFxn = "&myUserReady";

    //Idle.addFunc('&uartPrintf_flush');

    //xdc_runtime_SysCallback.putchFxn = "&uartPrintf_putch";

    /* ================ Application Specific Instances ================ */

    //xdc_runtime_SysCallback.flushFxn = "&uartPrintf_flush";

    /* ================ Task configuration ================ */

    var Task = xdc.useModule('ti.sysbios.knl.Task');

    /*

    * Check task stacks for overflow conditions.

    *

    * Pick one:

    *  - true (default)

    *      Enables runtime checks for task stack overflow conditions during

    *      context switching ("from" and "to")

    *  - false

    *      Disables runtime checks for task stack overflow conditions.

    */

    Task.checkStackFlag = true;

    //Task.checkStackFlag = false;

    /* Enable idle task (default). */

    Task.enableIdleTask = true;

    /*

    * Set the default task stack size when creating tasks.

    *

    * The default is dependent on the device being used. Reducing the default stack

    * size yields greater memory savings.

    */

    Task.defaultStackSize = 512;

    /*

    * Enables the idle task.

    *

    * Pick one:

    *  - true (default)

    *      Creates a task with priority of 0 which calls idle hook functions. This

    *      option must be set to true to gain power savings provided by the Power

    *      module.

    *  - false

    *      No idle task is created. This option consumes less memory as no

    *      additional default task stack is needed.

    *      To gain power savings by the Power module without having the idle task,

    *      add Idle.run as the Task.allBlockedFunc.

    */

    Task.enableIdleTask = true;

    //Task.enableIdleTask = false;

    //Task.allBlockedFunc = Idle.run;

    /*

    * If Task.enableIdleTask is set to true, this option sets the idle task's

    * stack size.

    *

    * Reducing the idle stack size yields greater memory savings.

    */

    Task.idleTaskStackSize = 256;

    /*

    * Reduce the number of task priorities.

    * The default is 16.

    * Decreasing the number of task priorities yield memory savings.

    */

    Task.numPriorities = 6; // was 6

    /* ================ Text configuration ================ */

    var Text = xdc.useModule('xdc.runtime.Text');

    /*

    * These strings are placed in the .const section. Setting this parameter to

    * false will save space in the .const section. Error, Assert and Log messages

    * will print raw ids and args instead of a formatted message.

    *

    * Pick one:

    *  - true (default)

    *      This option loads test string into the .const for easier debugging.

    *  - false

    *      This option reduces the .const footprint.

    */

    //Text.isLoaded = true;

    Text.isLoaded = true;

    /* ================ Types configuration ================ */

    var Types = xdc.useModule('xdc.runtime.Types');

    /*

    * This module defines basic constants and types used throughout the

    * xdc.runtime package.

    */

    /* ================ TI-RTOS middleware configuration ================ */

    var mwConfig = xdc.useModule('ti.mw.Config');

    /*

    * Include TI-RTOS middleware libraries

    */

    /* ================ TI-RTOS drivers' configuration ================ */

    var driversConfig = xdc.useModule('ti.drivers.Config');

    /*

    * Include TI-RTOS drivers

    *

    * Pick one:

    *  - driversConfig.LibType_NonInstrumented (default)

    *      Use TI-RTOS drivers library optimized for footprint and performance

    *      without asserts or logs.

    *  - driversConfig.LibType_Instrumented

    *      Use TI-RTOS drivers library for debugging with asserts and logs enabled.

    */

    driversConfig.libType = driversConfig.LibType_Instrumented;

    //driversConfig.libType = driversConfig.LibType_Instrumented;

    /* ================ Driver configuration ================ */

    TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');

    //TIRTOS.useGPIO = true;

    TIRTOS.useI2C = true;

    TIRTOS.useSPI = true;

    /* ================ Hwi configuration ================ */

    /*

    * All Hwis for MSP430 must be created statically; including Hwis for TI-RTOS

    * drivers

    */

    Clock.swiPriority = 5;

    Clock.tickMode = Clock.TickMode_DYNAMIC;

    BIOS.customCCOpts = "-vmspx --near_data=none --code_model=large --data_model=restricted -q --advice:power=1  --program_level_compile -g";

    BIOS.heapTrackEnabled = true;

    Error.policy = Error.TERMINATE;

    Defaults.common$.diags_INTERNAL = xdc.module("xdc.runtime.Diags").ALWAYS_ON;

    Defaults.common$.diags_ASSERT = xdc.module("xdc.runtime.Diags").ALWAYS_ON;

    var ti_sysbios_family_msp430_Hwi0Params = new ti_sysbios_family_msp430_Hwi.Params();

    ti_sysbios_family_msp430_Hwi0Params.instance.name = "I2C_hwi";

    Program.global.I2C_hwi = ti_sysbios_family_msp430_Hwi.create(55, "&I2CUSCIB_hwiIntFxn", ti_sysbios_family_msp430_Hwi0Params);

    var ti_sysbios_family_msp430_Hwi1Params = new ti_sysbios_family_msp430_Hwi.Params();

    ti_sysbios_family_msp430_Hwi1Params.instance.name = "spi_dma_hwi";

    Program.global.spi_dma_hwi = ti_sysbios_family_msp430_Hwi.create(50, "&MSP_EXP430F5529LP_isrDMA", ti_sysbios_family_msp430_Hwi1Params);

    var ti_sysbios_family_msp430_Hwi2Params = new ti_sysbios_family_msp430_Hwi.Params();

    ti_sysbios_family_msp430_Hwi2Params.instance.name = "gpio_hwi";

    Program.global.gpio_hwi = ti_sysbios_family_msp430_Hwi.create(47, "&GPIO_hwiIntFxn", ti_sysbios_family_msp430_Hwi2Params);

    var platformInstance0 = xdc.lookup('ti.platforms.msp430.Platform.Instance#0');

    Swi.numPriorities = 6;

    mwConfig.provideWiFiCC3X00Lib = false;

    var task0Params = new Task.Params();

    task0Params.instance.name = "TempCntrlTask";

    task0Params.priority = 2;

    task0Params.stackSize = 1024;

    task0Params.stack = null;

    task0Params.arg0 = "&a0";

    task0Params.arg1 = "&a1";

    Program.global.TempCntrlTask = Task.create("&TempControl_taskFxn", task0Params);

    var task1Params = new Task.Params();

    task1Params.instance.name = "UiTask";

    task1Params.stackSize = 1024;

    task1Params.stack = null;

    task1Params.stackSection = ".bss:taskStackSection";

    task1Params.arg0 = "&a0";

    task1Params.arg1 = "&a1";

    Program.global.UiTask = Task.create("&UserInterface_taskFxn", task1Params);

    LoggingSetup.sysbiosSemaphoreLogging = true;

    LoggingSetup.sysbiosSwiLogging = true;

    LoggingSetup.enableTaskProfiler = true;

    LoggingSetup.mainLoggerSize = 64;

    LoggingSetup.sysbiosLoggerSize = 256;

    LoggingSetup.loadLoggerSize = 128;

  • Two things concern me:

    1) Using a Clock.tickPeriod of 10us is dangerous because all timeouts in SYS/BIOS APIs (Task_sleep(), Semaphore_pend(), etc) are in units of the Clock.tickPeriod. The MSP430 can not keep up with a sustained clock tick interrupt of 10us.

    2) The timeout argument passed to Util_send_to_queue() is troublesome. This function is being called from a Clock function which runs within a Swi context. Does this API block if the queue is full? Blocking within a Swi is forbidden and will result in application failure.

    Alan