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.

RTOS/EK-TM4C129EXL: E_spOutOfBounds after Interrupt Service Routine

Part Number: EK-TM4C129EXL

Tool/software: TI-RTOS

Hello,

I am working with an EK-TM4C129EXL and I am using TI-RTOS 2.16.0.08 and NDK 2.25.00.09.

To give you a little bit of background. My Application should sample 20 ADC channels and send them via TCP to a Computer. The ADC channels are sampled by 2 ADCs which are using 2 Sequencers. The samples are then copied by the DMA in a ping pong transfer fashion. After a ping transfer is finished, ping should be transmitted via TCP while pong is filled with new samples.

The ISRs for the ADC sequencers are calling SWIs to reenable( uDMAChannelTransferSet ) the DMA transfers. The SWIs are posting a event to indicate that the corresponding memory, either ping or pong, is full. A task is pending on the corresponding events in order to indicate a different task which memory should be transferred via TCP.

Here an example ISR and SWI:

void SWI_Adc0Sequencer0(void)
{

    if(!uDMAChannelIsEnabled(UDMA_CHANNEL_ADC0))
    {
        uDMAChannelEnable(UDMA_CHANNEL_ADC0);
        uDMAChannelTransferSet(UDMA_CHANNEL_ADC0|UDMA_PRI_SELECT, UDMA_MODE_PINGPONG, VJADC0SS0FIFOADDRESS, p_u16_Adc0_Ss0_Udma_A, VJDMATRANSFERSIZE_SS0);
        ADC0Sequencer0SWI++;
    }
    ui32Mode=uDMAChannelModeGet(UDMA_CHANNEL_ADC0|UDMA_PRI_SELECT);
    if(ui32Mode==UDMA_MODE_STOP)
    {
        uDMAChannelTransferSet(UDMA_CHANNEL_ADC0|UDMA_PRI_SELECT, UDMA_MODE_PINGPONG, VJADC0SS0FIFOADDRESS, p_u16_Adc0_Ss0_Udma_A, VJDMATRANSFERSIZE_SS0);
        ADC0Sequencer0SWI_A++;
        Event_post(EventHandle_ABufferReady,Event_Id_00);
    }
    ui32Mode=uDMAChannelModeGet(UDMA_CHANNEL_ADC0|UDMA_ALT_SELECT);
    if(ui32Mode==UDMA_MODE_STOP)
    {
        uDMAChannelTransferSet(UDMA_CHANNEL_ADC0|UDMA_ALT_SELECT, UDMA_MODE_PINGPONG, VJADC0SS0FIFOADDRESS, p_u16_Adc0_Ss0_Udma_B, VJDMATRANSFERSIZE_SS0);
        ADC0Sequencer0SWI_B++;
        Event_post(EventHandle_BBufferReady,Event_Id_00);
    }
}

void ISR_Adc1Sequencer1(void)
{
    if((ADCSequenceOverflow(ADC1_BASE, 1)&&ADCSequenceUnderflow(ADC1_BASE, 1))==0)
    {
        /*
         * No overflow occurred, the interrupt flags are simply cleared
         */
        ADCIntClear(ADC1_BASE,1);
        ADCIntClearEx(ADC1_BASE, ADC_INT_DMA_SS1);
    }
    else
    {
        /*
         * An overflow occurred
         * the interrupt flags are cleared since otherwise the program would not run correctly anymore
         * To indicate the user that an error occurred, turn Led0 on and increase a counter
         */
        ADCIntClear(ADC1_BASE,1);
        ADCIntClearEx(ADC1_BASE, ADC_INT_DMA_SS1);
        ADCSequenceOverflowClear(ADC1_BASE, 1);
        Swi_post(Led0On);
        OverflowErrorAdc1SS1++;
    }
    Swi_post(Adc1Sequencer1);
    ADC1SEQUENCER1++;
}

The error I am facing is as following. The IDLE task is producing a exception, I think its a stack overflow, after the ISR corresponding to ADC1Sequencer1 is executed. In the following a screenshot, which shows the error msg and the ROV in order to see that the task which is causing the problem is the IdleTask.

As you can see I already tried to rise the StackSize of all tasks and if I am interpret the ROV correct the stack sizes should be more then big enough. I'm grateful for every idea how to solve the problem. In the following I also attach the my .cfg file, maybe it is something wrong there.

/*
 * 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.
 */



/* ================ Clock configuration ================ */
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
var Global = xdc.useModule('ti.ndk.config.Global');
var Tcp = xdc.useModule('ti.ndk.config.Tcp');
var Ip = xdc.useModule('ti.ndk.config.Ip');
var Event = xdc.useModule('ti.sysbios.knl.Event');
var Emac = xdc.useModule('ti.ndk.config.Emac');
/*
 * Default value is family dependent. For example, Linux systems often only
 * support a minimum period of 10000 us and multiples of 10000 us.
 * TI platforms have a default of 1000 us.
 */
Clock.tickPeriod = 1000;



/* ================ 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 halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.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.
 */
//halHwi.checkStackFlag = true;
halHwi.checkStackFlag = true;

/*
 * The following options alter the system's behavior when a hardware exception
 * is detected.
 *
 * Pick one:
 *  - Hwi.enableException = true
 *      This option causes the default m3Hwi.excHandlerFunc function to fully
 *      decode an exception and dump the registers to the system console.
 *      This option raises errors in the Error module and displays the
 *      exception in ROV.
 *  - Hwi.enableException = false
 *      This option reduces code footprint by not decoding or printing the
 *      exception to the system console.
 *      It however still raises errors in the Error module and displays the
 *      exception in ROV.
 *  - Hwi.excHandlerFunc = null
 *      This is the most aggressive option for code footprint savings; but it
 *      can difficult to debug exceptions. It reduces flash footprint by
 *      plugging in a default while(1) trap when exception occur. This option
 *      does not raise an error with the Error module.
 */
m3Hwi.enableException = true;
//m3Hwi.enableException = false;
//m3Hwi.excHandlerFunc = null;

/*
 * Enable hardware exception generation when dividing by zero.
 *
 * Pick one:
 *  - 0 (default)
 *      Disables hardware exceptions when dividing by zero
 *  - 1
 *      Enables hardware exceptions when dividing by zero
 */
m3Hwi.nvicCCR.DIV_0_TRP = 0;
//m3Hwi.nvicCCR.DIV_0_TRP = 1;

/*
 * Enable hardware exception generation for invalid data alignment.
 *
 * Pick one:
 *  - 0 (default)
 *      Disables hardware exceptions for data alignment
 *  - 1
 *      Enables hardware exceptions for data alignment
 */
m3Hwi.nvicCCR.UNALIGN_TRP = 0;
//m3Hwi.nvicCCR.UNALIGN_TRP = 1;



/* ================ 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 = true;

/*
 * Specify default heap size for BIOS.
 */
BIOS.heapSize = 52768;

/*
 * 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 = false;
//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_Custom;
//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 = true;



/* ================ 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).
 */



/* ================ 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 = 2048;
}



/*
 * Enable Semihosting for GNU targets to print to CCS console
 */
if (Program.build.target.$name.match(/gnu/)) {
    var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
}
/* ================ 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 = false;

/*
 * 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.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 = 1024;
System.SupportProxy = SysMin;
//var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
//System.SupportProxy = SysCallback;
//SysCallback.abortFxn = "&myUserAbort";
//SysCallback.exitFxn  = "&myUserExit";
//SysCallback.flushFxn = "&myUserFlush";
//SysCallback.putchFxn = "&myUserPutch";
//SysCallback.readyFxn = "&myUserReady";




/* ================ 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 = 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 = 1024;

/*
 * 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 = true;
//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 = 10240;

/*
 * Reduce the number of task priorities.
 * The default is 16.
 * Decreasing the number of task priorities yield memory savings.
 */
Task.numPriorities = 16;



/*
 * Idle Function list.
 *
 * Functions added here will be run continously within the idle task.
 *
 * Function signature:
 *     Void func(Void);
 */
//Idle.addFunc("&myIdleFunc");



/* ================ 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 = false;



/* ================ 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_NonInstrumented;
//driversConfig.libType = driversConfig.LibType_Instrumented;



/* ================ Application Specific Instances ================ */
var m3Hwi0Params = new m3Hwi.Params();
m3Hwi0Params.instance.name = "HwiHandle_Timer2";
m3Hwi0Params.priority = 0;
Program.global.HwiHandle_Timer2 = m3Hwi.create(39, "&ISR_Timer2", m3Hwi0Params);
LoggingSetup.sysbiosSwiLogging = true;
LoggingSetup.sysbiosHwiLogging = true;
var m3Hwi1Params = new m3Hwi.Params();
m3Hwi1Params.instance.name = "HwiHandle_Adc0Sequencer0";
m3Hwi1Params.priority = 1;
Program.global.HwiHandle_Adc0Sequencer0 = m3Hwi.create(30, "&ISR_Adc0Sequencer0", m3Hwi1Params);
var m3Hwi2Params = new m3Hwi.Params();
m3Hwi2Params.instance.name = "HwiHandle_Adc0Sequencer1";
m3Hwi2Params.priority = 1;
Program.global.HwiHandle_Adc0Sequencer1 = m3Hwi.create(31, "&ISR_Adc0Sequencer1", m3Hwi2Params);
var m3Hwi3Params = new m3Hwi.Params();
m3Hwi3Params.instance.name = "HwiHandle_Adc1Sequencer0";
m3Hwi3Params.priority = 1;
Program.global.HwiHandle_Adc1Sequencer0 = m3Hwi.create(62, "&ISR_Adc1Sequencer0", m3Hwi3Params);
var m3Hwi4Params = new m3Hwi.Params();
m3Hwi4Params.instance.name = "HwiHandle_Adc1Sequencer1";
m3Hwi4Params.priority = 1;
Program.global.HwiHandle_Adc1Sequencer1 = m3Hwi.create(63, "&ISR_Adc1Sequencer1", m3Hwi4Params);
m3Hwi.dispatcherAutoNestingSupport = false;
var swi0Params = new Swi.Params();
swi0Params.instance.name = "Adc0Sequencer0";
swi0Params.priority = 0;
Program.global.Adc0Sequencer0 = Swi.create("&SWI_Adc0Sequencer0", swi0Params);
var swi1Params = new Swi.Params();
swi1Params.instance.name = "Adc0Sequencer1";
swi1Params.priority = 0;
Program.global.Adc0Sequencer1 = Swi.create("&SWI_Adc0Sequencer1", swi1Params);
LoggingSetup.loadTaskLogging = true;
LoggingSetup.loadSwiLogging = true;
LoggingSetup.loadHwiLogging = true;
LoggingSetup.enableTaskProfiler = true;
LoggingSetup.loadLoggerSize = 15000;
LoggingSetup.mainLoggerSize = 1024;
var swi2Params = new Swi.Params();
swi2Params.instance.name = "Adc1Sequencer0";
swi2Params.priority = 0;
Program.global.Adc1Sequencer0 = Swi.create("&SWI_Adc1Sequencer0", swi2Params);
var swi3Params = new Swi.Params();
swi3Params.instance.name = "Adc1Sequencer1";
swi3Params.priority = 0;
Program.global.Adc1Sequencer1 = Swi.create("&SWI_Adc1Sequencer1", swi3Params);
var swi4Params = new Swi.Params();
swi4Params.instance.name = "Led0On";
swi4Params.priority = 2;
Program.global.Led0On = Swi.create("&SWI_LED0On", swi4Params);
Ip.autoIp = false;
Ip.address = "192.168.1.2";
Global.networkOpenHook = "&netOpen";
Global.memRawPageCount = 6;
Global.pktNumFrameBufs = 10;
Global.ndkThreadStackSize = 5120;
Global.lowTaskStackSize = 5120;
Global.normTaskStackSize = 5120;
Global.highTaskStackSize = 5120;
Memory.defaultHeapSize = 20480;
var event0Params = new Event.Params();
event0Params.instance.name = "EventHandle_Tcp";
Program.global.EventHandle_Tcp = Event.create(event0Params);
var event1Params = new Event.Params();
event1Params.instance.name = "EventHandle_ABufferReady";
Program.global.EventHandle_ABufferReady = Event.create(event1Params);
var event2Params = new Event.Params();
event2Params.instance.name = "EventHandle_BBufferReady";
Program.global.EventHandle_BBufferReady = Event.create(event2Params);
Global.netSchedulerPri = Global.NC_PRIORITY_HIGH;
var event3Params = new Event.Params();
event3Params.instance.name = "EventHandle_TaskSetupReady";
Program.global.EventHandle_TaskSetupReady = Event.create(event3Params);
var event4Params = new Event.Params();
event4Params.instance.name = "EventHandle_Error";
Program.global.EventHandle_Error = Event.create(event4Params);
LoggingSetup.sysbiosSemaphoreLogging = true;
Tcp.transmitBufSize = 2048;
Ip.socketBufMinTxSize = 512;
Tcp.maxNumReasmPkts = 32;
LoggingSetup.sysbiosLoggerSize = 15000;
LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;

Thanks in advance and best regards,

Richard

  • Hi Richard,
    I'm not an TI-RTOS expert and may need to ask our RTOS expert for guidance. However, looking at your error I would doubt that you have a stack problem with the idle task. You have already reserved 10240 bytes of stack for the idle task which is a lot in my opinion. I would instead try to increase the default task stack size to 2048 instead of 1024 as what you currently have and also revert the idle stack size from 10240 to 2048 and see if that makes a difference.

    One thing to also make sure is that you can only have one task to pend on one event object at a time. You cannot have multiple tasks pending on the same event object. For example, do you have multiple tasks that will unblock based on EventHandle_ABufferReady? Perhaps you don't have such issue but just wanted to make sure.

    Another question I have is if you first limit your application to only ADC0 and not using ADC1 will it work without any error? It will be easier to start with something small and making sure it works before adding incremental capabilities.
  • Hi Charles,

    thank you for your replie.

    Charles Tsai said:

    You have already reserved 10240 bytes of stack for the idle task which is a lot in my opinion. I would instead try to increase the default task stack size to 2048 instead of 1024 as what you currently have and also revert the idle stack size from 10240 to 2048 and see if that makes a difference.

    I only increased the idle stack size to rule out that this could cause any problem. I switched it back and increased the default stack size ass suggested but the error still exists.

    Charles Tsai said:


    One thing to also make sure is that you can only have one task to pend on one event object at a time. You cannot have multiple tasks pending on the same event object. For example, do you have multiple tasks that will unblock based on EventHandle_ABufferReady? Perhaps you don't have such issue but just wanted to make sure.

    Only a single task, VJ_TaskABufferFull for the EventHandle_ABufferReady and VJ_TaskBBufferFull for the EventHandle_BBufferReady, is pending on the events. And only the SWIs are posting to them, I hope that isn't a problem. But I checked it in the documentation and it shouldn't be.

    Charles Tsai said:

    Another question I have is if you first limit your application to only ADC0 and not using ADC1 will it work without any error? It will be easier to start with something small and making sure it works before adding incremental capabilities.

    I checked that and the error also occures if only a single ADC, ADC0, is running. The only difference is that then the error occurs after ISR_Adc0Sequencer1. Here the screenshot of the debugging session:

    I again post my .cfg file with the changes I made, just to make shure I did everything as you suggested.

    /*
     * 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.
     */
    
    
    
    /* ================ Clock configuration ================ */
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    var Global = xdc.useModule('ti.ndk.config.Global');
    var Tcp = xdc.useModule('ti.ndk.config.Tcp');
    var Ip = xdc.useModule('ti.ndk.config.Ip');
    var Event = xdc.useModule('ti.sysbios.knl.Event');
    var Emac = xdc.useModule('ti.ndk.config.Emac');
    /*
     * Default value is family dependent. For example, Linux systems often only
     * support a minimum period of 10000 us and multiples of 10000 us.
     * TI platforms have a default of 1000 us.
     */
    Clock.tickPeriod = 1000;
    
    
    
    /* ================ 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 halHwi = xdc.useModule('ti.sysbios.hal.Hwi');
    var m3Hwi = xdc.useModule('ti.sysbios.family.arm.m3.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.
     */
    //halHwi.checkStackFlag = true;
    halHwi.checkStackFlag = true;
    
    /*
     * The following options alter the system's behavior when a hardware exception
     * is detected.
     *
     * Pick one:
     *  - Hwi.enableException = true
     *      This option causes the default m3Hwi.excHandlerFunc function to fully
     *      decode an exception and dump the registers to the system console.
     *      This option raises errors in the Error module and displays the
     *      exception in ROV.
     *  - Hwi.enableException = false
     *      This option reduces code footprint by not decoding or printing the
     *      exception to the system console.
     *      It however still raises errors in the Error module and displays the
     *      exception in ROV.
     *  - Hwi.excHandlerFunc = null
     *      This is the most aggressive option for code footprint savings; but it
     *      can difficult to debug exceptions. It reduces flash footprint by
     *      plugging in a default while(1) trap when exception occur. This option
     *      does not raise an error with the Error module.
     */
    m3Hwi.enableException = true;
    //m3Hwi.enableException = false;
    //m3Hwi.excHandlerFunc = null;
    
    /*
     * Enable hardware exception generation when dividing by zero.
     *
     * Pick one:
     *  - 0 (default)
     *      Disables hardware exceptions when dividing by zero
     *  - 1
     *      Enables hardware exceptions when dividing by zero
     */
    m3Hwi.nvicCCR.DIV_0_TRP = 0;
    //m3Hwi.nvicCCR.DIV_0_TRP = 1;
    
    /*
     * Enable hardware exception generation for invalid data alignment.
     *
     * Pick one:
     *  - 0 (default)
     *      Disables hardware exceptions for data alignment
     *  - 1
     *      Enables hardware exceptions for data alignment
     */
    m3Hwi.nvicCCR.UNALIGN_TRP = 0;
    //m3Hwi.nvicCCR.UNALIGN_TRP = 1;
    
    
    
    /* ================ 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 = true;
    
    /*
     * Specify default heap size for BIOS.
     */
    BIOS.heapSize = 52768;
    
    /*
     * 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 = false;
    //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_Custom;
    //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 = true;
    
    
    
    /* ================ 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).
     */
    
    
    
    /* ================ 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 = 10240;
    }
    
    
    
    /*
     * Enable Semihosting for GNU targets to print to CCS console
     */
    if (Program.build.target.$name.match(/gnu/)) {
        var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
    }
    /* ================ 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 = false;
    
    /*
     * 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.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 = 1024;
    System.SupportProxy = SysMin;
    //var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
    //System.SupportProxy = SysCallback;
    //SysCallback.abortFxn = "&myUserAbort";
    //SysCallback.exitFxn  = "&myUserExit";
    //SysCallback.flushFxn = "&myUserFlush";
    //SysCallback.putchFxn = "&myUserPutch";
    //SysCallback.readyFxn = "&myUserReady";
    
    
    
    
    /* ================ 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 = 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 = 10240;
    
    /*
     * 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 = true;
    //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 = 1024;
    
    /*
     * Reduce the number of task priorities.
     * The default is 16.
     * Decreasing the number of task priorities yield memory savings.
     */
    Task.numPriorities = 16;
    
    
    
    /*
     * Idle Function list.
     *
     * Functions added here will be run continously within the idle task.
     *
     * Function signature:
     *     Void func(Void);
     */
    //Idle.addFunc("&myIdleFunc");
    
    
    
    /* ================ 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 = false;
    
    
    
    /* ================ 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_NonInstrumented;
    //driversConfig.libType = driversConfig.LibType_Instrumented;
    
    
    
    /* ================ Application Specific Instances ================ */
    var m3Hwi0Params = new m3Hwi.Params();
    m3Hwi0Params.instance.name = "HwiHandle_Timer2";
    m3Hwi0Params.priority = 0;
    Program.global.HwiHandle_Timer2 = m3Hwi.create(39, "&ISR_Timer2", m3Hwi0Params);
    LoggingSetup.sysbiosSwiLogging = true;
    LoggingSetup.sysbiosHwiLogging = true;
    var m3Hwi1Params = new m3Hwi.Params();
    m3Hwi1Params.instance.name = "HwiHandle_Adc0Sequencer0";
    m3Hwi1Params.priority = 1;
    Program.global.HwiHandle_Adc0Sequencer0 = m3Hwi.create(30, "&ISR_Adc0Sequencer0", m3Hwi1Params);
    var m3Hwi2Params = new m3Hwi.Params();
    m3Hwi2Params.instance.name = "HwiHandle_Adc0Sequencer1";
    m3Hwi2Params.priority = 1;
    Program.global.HwiHandle_Adc0Sequencer1 = m3Hwi.create(31, "&ISR_Adc0Sequencer1", m3Hwi2Params);
    var m3Hwi3Params = new m3Hwi.Params();
    m3Hwi3Params.instance.name = "HwiHandle_Adc1Sequencer0";
    m3Hwi3Params.priority = 1;
    Program.global.HwiHandle_Adc1Sequencer0 = m3Hwi.create(62, "&ISR_Adc1Sequencer0", m3Hwi3Params);
    var m3Hwi4Params = new m3Hwi.Params();
    m3Hwi4Params.instance.name = "HwiHandle_Adc1Sequencer1";
    m3Hwi4Params.priority = 1;
    Program.global.HwiHandle_Adc1Sequencer1 = m3Hwi.create(63, "&ISR_Adc1Sequencer1", m3Hwi4Params);
    m3Hwi.dispatcherAutoNestingSupport = false;
    var swi0Params = new Swi.Params();
    swi0Params.instance.name = "Adc0Sequencer0";
    swi0Params.priority = 0;
    Program.global.Adc0Sequencer0 = Swi.create("&SWI_Adc0Sequencer0", swi0Params);
    var swi1Params = new Swi.Params();
    swi1Params.instance.name = "Adc0Sequencer1";
    swi1Params.priority = 0;
    Program.global.Adc0Sequencer1 = Swi.create("&SWI_Adc0Sequencer1", swi1Params);
    LoggingSetup.loadTaskLogging = true;
    LoggingSetup.loadSwiLogging = true;
    LoggingSetup.loadHwiLogging = true;
    LoggingSetup.enableTaskProfiler = true;
    LoggingSetup.loadLoggerSize = 15000;
    LoggingSetup.mainLoggerSize = 1024;
    var swi2Params = new Swi.Params();
    swi2Params.instance.name = "Adc1Sequencer0";
    swi2Params.priority = 0;
    Program.global.Adc1Sequencer0 = Swi.create("&SWI_Adc1Sequencer0", swi2Params);
    var swi3Params = new Swi.Params();
    swi3Params.instance.name = "Adc1Sequencer1";
    swi3Params.priority = 0;
    Program.global.Adc1Sequencer1 = Swi.create("&SWI_Adc1Sequencer1", swi3Params);
    var swi4Params = new Swi.Params();
    swi4Params.instance.name = "Led0On";
    swi4Params.priority = 2;
    Program.global.Led0On = Swi.create("&SWI_LED0On", swi4Params);
    Ip.autoIp = false;
    Ip.address = "192.168.1.2";
    Global.networkOpenHook = "&netOpen";
    Global.memRawPageCount = 6;
    Global.pktNumFrameBufs = 10;
    Global.ndkThreadStackSize = 5120;
    Global.lowTaskStackSize = 5120;
    Global.normTaskStackSize = 5120;
    Global.highTaskStackSize = 5120;
    Memory.defaultHeapSize = 20480;
    var event0Params = new Event.Params();
    event0Params.instance.name = "EventHandle_Tcp";
    Program.global.EventHandle_Tcp = Event.create(event0Params);
    var event1Params = new Event.Params();
    event1Params.instance.name = "EventHandle_ABufferReady";
    Program.global.EventHandle_ABufferReady = Event.create(event1Params);
    var event2Params = new Event.Params();
    event2Params.instance.name = "EventHandle_BBufferReady";
    Program.global.EventHandle_BBufferReady = Event.create(event2Params);
    Global.netSchedulerPri = Global.NC_PRIORITY_HIGH;
    var event3Params = new Event.Params();
    event3Params.instance.name = "EventHandle_TaskSetupReady";
    Program.global.EventHandle_TaskSetupReady = Event.create(event3Params);
    var event4Params = new Event.Params();
    event4Params.instance.name = "EventHandle_Error";
    Program.global.EventHandle_Error = Event.create(event4Params);
    LoggingSetup.sysbiosSemaphoreLogging = true;
    Tcp.transmitBufSize = 2048;
    Ip.socketBufMinTxSize = 512;
    Tcp.maxNumReasmPkts = 32;
    LoggingSetup.sysbiosLoggerSize = 15000;
    LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
    BIOS.heapTrackEnabled = true;
    

    Best Regards,

    Richard

  • Hi,

    I have some "new" results. I switched the priority of the HWI in order to let them be under the control of the RTOS, their type is now "Dispatched" and not "zero Delay" anymore. This helped to get rid of the strange exception behavior described in the earlier post.  But this helped just to delay the problem. After about 40 to 50 TCP transfers, that means the ADCs and the DMA transfers are running without problems, the HWI corresponding to Adc0Sequencer0 are causing problems. It seems as the interrupt is never cleared or stay always active without a chance for the OS to do anything else as executing the corresponding ISR. I can tell that cause a counting variable is incremented in the ISRs. No other ISRs are executed, no tasks and Swis as well. So to me it still seems like a OS/Stack/MemoryLeak problem but I am out of Ideas. In the following a screenshot of the ROV and a copy of my .cfg file so that you can see my changes.

    And here my .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.
     */
    
    
    
    /* ================ Clock configuration ================ */
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
    var Global = xdc.useModule('ti.ndk.config.Global');
    var Tcp = xdc.useModule('ti.ndk.config.Tcp');
    var Ip = xdc.useModule('ti.ndk.config.Ip');
    var Event = xdc.useModule('ti.sysbios.knl.Event');
    var Emac = xdc.useModule('ti.ndk.config.Emac');
    var Hwi = xdc.useModule('ti.sysbios.family.arm.m3.Hwi');
    /*
     * Default value is family dependent. For example, Linux systems often only
     * support a minimum period of 10000 us and multiples of 10000 us.
     * TI platforms have a default of 1000 us.
     */
    Clock.tickPeriod = 1000;
    
    
    
    /* ================ 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 halHwi = xdc.useModule('ti.sysbios.hal.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.
     */
    //halHwi.checkStackFlag = true;
    halHwi.checkStackFlag = true;
    //m3Hwi.nvicCCR.UNALIGN_TRP = 1;
    
    
    
    /* ================ 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 = true;
    
    /*
     * Specify default heap size for BIOS.
     */
    BIOS.heapSize = 42768;
    
    /*
     * 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 = false;
    //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_Custom;
    //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 = true;
    
    
    
    /* ================ 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).
     */
    
    
    
    /* ================ 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 = 10240;
    }
    
    
    
    /*
     * Enable Semihosting for GNU targets to print to CCS console
     */
    if (Program.build.target.$name.match(/gnu/)) {
        var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
    }
    /* ================ 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 = false;
    
    /*
     * 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.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 = 1024;
    System.SupportProxy = SysMin;
    //var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
    //System.SupportProxy = SysCallback;
    //SysCallback.abortFxn = "&myUserAbort";
    //SysCallback.exitFxn  = "&myUserExit";
    //SysCallback.flushFxn = "&myUserFlush";
    //SysCallback.putchFxn = "&myUserPutch";
    //SysCallback.readyFxn = "&myUserReady";
    
    
    
    
    /* ================ 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 = 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 = 10240;
    
    /*
     * 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 = true;
    //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 = 1024;
    
    /*
     * Reduce the number of task priorities.
     * The default is 16.
     * Decreasing the number of task priorities yield memory savings.
     */
    Task.numPriorities = 16;
    
    
    
    /*
     * Idle Function list.
     *
     * Functions added here will be run continously within the idle task.
     *
     * Function signature:
     *     Void func(Void);
     */
    //Idle.addFunc("&myIdleFunc");
    
    
    
    /* ================ 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 = false;
    
    
    
    /* ================ 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_NonInstrumented;
    var swi0Params = new Swi.Params();
    swi0Params.instance.name = "Adc0Sequencer0";
    swi0Params.priority = 15;
    Program.global.Adc0Sequencer0 = Swi.create("&SWI_Adc0Sequencer0", swi0Params);
    var swi1Params = new Swi.Params();
    swi1Params.instance.name = "Adc0Sequencer1";
    swi1Params.priority = 1;
    Program.global.Adc0Sequencer1 = Swi.create("&SWI_Adc0Sequencer1", swi1Params);
    LoggingSetup.loadTaskLogging = true;
    LoggingSetup.loadSwiLogging = true;
    LoggingSetup.loadHwiLogging = true;
    LoggingSetup.enableTaskProfiler = true;
    LoggingSetup.loadLoggerSize = 15000;
    LoggingSetup.mainLoggerSize = 1024;
    var swi2Params = new Swi.Params();
    swi2Params.instance.name = "Adc1Sequencer0";
    swi2Params.priority = 2;
    Program.global.Adc1Sequencer0 = Swi.create("&SWI_Adc1Sequencer0", swi2Params);
    var swi3Params = new Swi.Params();
    swi3Params.instance.name = "Adc1Sequencer1";
    swi3Params.priority = 3;
    Program.global.Adc1Sequencer1 = Swi.create("&SWI_Adc1Sequencer1", swi3Params);
    var swi4Params = new Swi.Params();
    swi4Params.instance.name = "Led0On";
    swi4Params.priority = 15;
    Program.global.Led0On = Swi.create("&SWI_LED0On", swi4Params);
    Ip.autoIp = false;
    Ip.address = "192.168.1.2";
    Global.networkOpenHook = "&netOpen";
    Global.memRawPageCount = 6;
    Global.pktNumFrameBufs = 10;
    Global.ndkThreadStackSize = 5120;
    Global.lowTaskStackSize = 5120;
    Global.normTaskStackSize = 5120;
    Global.highTaskStackSize = 5120;
    var event0Params = new Event.Params();
    event0Params.instance.name = "EventHandle_Tcp";
    Program.global.EventHandle_Tcp = Event.create(event0Params);
    var event1Params = new Event.Params();
    event1Params.instance.name = "EventHandle_ABufferReady";
    Program.global.EventHandle_ABufferReady = Event.create(event1Params);
    var event2Params = new Event.Params();
    event2Params.instance.name = "EventHandle_BBufferReady";
    Program.global.EventHandle_BBufferReady = Event.create(event2Params);
    Global.netSchedulerPri = Global.NC_PRIORITY_HIGH;
    var event3Params = new Event.Params();
    event3Params.instance.name = "EventHandle_TaskSetupReady";
    Program.global.EventHandle_TaskSetupReady = Event.create(event3Params);
    var event4Params = new Event.Params();
    event4Params.instance.name = "EventHandle_Error";
    Program.global.EventHandle_Error = Event.create(event4Params);
    LoggingSetup.sysbiosSemaphoreLogging = true;
    Tcp.transmitBufSize = 2048;
    Ip.socketBufMinTxSize = 512;
    Tcp.maxNumReasmPkts = 32;
    LoggingSetup.sysbiosLoggerSize = 15000;
    LoggingSetup.loggerType = LoggingSetup.LoggerType_STOPMODE;
    BIOS.heapTrackEnabled = true;
    var hwi0Params = new Hwi.Params();
    hwi0Params.instance.name = "HwiHandle_Adc0Sequencer0";
    hwi0Params.priority = 255;
    hwi0Params.enableInt = true;
    Program.global.HwiHandle_Adc0Sequencer0 = Hwi.create(30, "&ISR_Adc0Sequencer0", hwi0Params);
    var hwi1Params = new Hwi.Params();
    hwi1Params.instance.name = "HwiHandle_Adc0Sequencer1";
    hwi1Params.priority = 255;
    hwi1Params.enableInt = true;
    Program.global.HwiHandle_Adc0Sequencer1 = Hwi.create(31, "&ISR_Adc0Sequencer1", hwi1Params);
    var hwi2Params = new Hwi.Params();
    hwi2Params.instance.name = "HwiHandle_Adc1Sequencer0";
    hwi2Params.priority = 255;
    hwi2Params.enableInt = true;
    Program.global.HwiHandle_Adc1Sequencer0 = Hwi.create(62, "&ISR_Adc1Sequencer0", hwi2Params);
    var hwi3Params = new Hwi.Params();
    hwi3Params.instance.name = "HwiHandle_Adc1Sequencer1";
    hwi3Params.priority = 255;
    Program.global.HwiHandle_Adc1Sequencer1 = Hwi.create(63, "&ISR_Adc1Sequencer1", hwi3Params);
    var hwi4Params = new Hwi.Params();
    hwi4Params.instance.name = "HwiHandle_Timer2";
    hwi4Params.priority = 255;
    hwi4Params.enableInt = true;
    Program.global.HwiHandle_Timer2 = Hwi.create(39, "&ISR_Timer2", hwi4Params);
    

    Thanks in advance to everybody reading this.

    Best regards,

    Richard

  • Hi Richard,
    Can you show your ISR code corresponding to the Adc0Sequencer0? I want to see how you clear the ADC interrupt flags. It looks like ISR for ADC0SEQUENCER0 keeps re-entering. Can you also try to read the interrupt flags (using ADCIntStatus) after you clear the flags. The reason is that there is a write buffer in the Cortex-M processor and it may take some cycles before the flags are actually cleared. If you clear the flags and immediately exit the ISR then it may cause the interrupt to re-enter. If you try to read the flags after you clear then it guarantees that the flags are actually cleared before the ISR is exited. Please give it a try.
  • Hi Charles,

    thank you for your replie.

    Charles Tsai said:

    Can you show your ISR code corresponding to the Adc0Sequencer0?

    I showed it in my original post.

    Charles Tsai said:

    Can you also try to read the interrupt flags (using ADCIntStatus) after you clear the flags. The reason is that there is a write buffer in the Cortex-M processor and it may take some cycles before the flags are actually cleared. If you clear the flags and immediately exit the ISR then it may cause the interrupt to re-enter. If you try to read the flags after you clear then it guarantees that the flags are actually cleared before the ISR is exited. Please give it a try.

    I will try that first thing in the morning.

    Best Regards,

    Richard

  • Hi Richard,
    Is the problem resolved?
  • Hello Charles,

    sorry for the late response!

    Yes the problem is resolved but had a completely different solution.

    We used the function EK_TM4C129EXL_initDMA which is written in the file EK_TM4C129EXL.c. This file is included in the standard RTOS project from which we were building our program on. It provides init functions for some peripherals, e.g. WiFi. Inside those init function EK_TM4C129EXL_initDMA is called. EK_TM4C129EXL_initDMA basically just turns on the UDMA, gives it a control structure and set a flag such that the other peripherals, which need to use the UDMA know that the DMA was already initialized and a control structure given. However in EK_TM4C129EXL.c the control structure only contains 32 entries, but since we are using the ping-pong mode we need 64 entries, 32 for the primary transfers and 32 for the alternative transfers. Unfortunately the DMA control structure was placed directly near some memory area which contained important data regarding the HWIs. So everytime we set the alternative DMA transfer we wrote some data in this area. Anyway, we changed the size of the DMA control structure from 32 to 64 and don't have any problems anymore.

    Best regards,

    Richard