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.

How to Run Task Iteration Continuously inside the Sensor Controller (outside of Sensor Controller Studio)

Other Parts Discussed in Thread: CC1310

Ultra-Low-Power Sensor Controller

  • Can Run Autonomously From the Rest of the System
  • 16-Bit Architecture
  • 2KB of Ultra-Low-Leakage SRAM for Code and Data

The code is now fully debugged inside SCS and all logic signals from the i2c are perfect, including continuous task iteration.

How is the code (initialization, execution, or termination) run continuously? The preferred code is the execution code, but it could be any of the three. The initiation and execution code contains fwSchedule(1) as per instructions. While sniffing the i2c w/ a logic analyzer, the line is quiet and no iteration is occurring.

Thanks to any and all questions, answers and comments! Patrick

/*
 *  ======== main_tirtos.c ========
 */

/* RTOS header files */
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/BIOS.h>

/* Sensor Controller header files*/
#include "scif.h"

/* Bitmask for scif task toggle */
#define BV(x)    (1 << (x))

/* Stack size in bytes */
#define THREADSTACKSIZE    1024

/* V0.2A Board Header files */
#include "Board.h"


/* Sensor Controller HWI calls */
void scCtrlReadyCallback(void)
{ } // scCtrlReadyCallback
void scTaskAlertCallback(void)
{ } // scTaskAlertCallback

int main(void)
{
    /* Initialize the Sensor Controller hardware */
    scifInit(&scifDriverSetup);

    /* Initialize HAL for Sensor Controller (for HWI calls) */
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);

    /* Set the Sensor Controller task tick interval to 1 second */
    uint32_t rtc_Hz = 1;  // 1Hz RTC
    scifStartRtcTicksNow(0x00010000 / rtc_Hz);

    // Reset all data structures except configuration
    scifResetTaskStructs(1 << SCIF_SCIF6075I2C_TASK_ID, (1 << SCIF_STRUCT_INPUT) | (1 << SCIF_STRUCT_OUTPUT));

    // Run initialization code for "scif6075i2c" Sensor Controller task one time
    if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
        //... Handle timeout or usage error ...
    } else if (scifStartTasksNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
        //... Handle usage error ...
    }

    // Run initialization code, execution code and termination code for "scif6075i2c" Sensor Controller task one time
    if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
        //... Handle timeout or usage error ...
    } else if (scifExecuteTasksOnceNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
        //... Handle usage error ...
    }

        // Run "scif6075i2c" Execution Code one time
    if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
     //   ... Handle timeout or usage error ...
    } else if (scifSwTriggerExecutionCodeNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
     //   ... Handle usage error ...
    }


    // Run termination code for "scif6075i2c" Sensor Controller task one time
    if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
        //... Handle timeout or usage error ...
    } else if (scifStopTasksNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
        //... Handle usage error ...
    }


    BIOS_start();

    /*scifStartRtcTicksNow(0x00010000/ rtc_Hz);–
     * Can only be used if the RTC-BasedExecutionSchedulingtask resource has been included in SCS.–
     * Starts the real-time clock with a frequency of rtc_HzHz.–
     * Use fwScheduleTask(N)to schedule the execution code N rtc ticks ahead.
     * NOTE:fwScheduleTask(N)is necessary in both the initialization and execution code of the SC.
     * It is a good idea to keep N as low as possible and rtc_Hzat the desired wake-up frequency in order to reduce unnecessary wake-ups.*/

    /*e2e.ti.com/.../

}

  • Hi Patrick,

    Have you done the Sensor Controller SimpleLink Academy Labs? It is explained in the Sensor Controller Fundamentals lab.

    To put it short, your Sensor Controller task must itself schedule the next task iteration with either RTC scheduling or Event Trigger scheduling. Judging by the code snippet you provided you are using RTC scheduling. That means the Execution Code in your SC Task must call fwScheduleTask() after each iteration, and in your TI-RTOS application you call scifStartTasksNbl() once after the RTC has been configured.
  • Severin,

    yes, I've done the labs but must have missed where it is explained in the Sensor Controller Fundamentals lab.

    Is fwSchedulTask() placed as the first line of code or the last line of the initialization and execution SCS code? At the moment, fwScheduleTask() is placed as the first line of code.

    thanks!

    Patrick

  • fwScheduleTask(N) schedules a single execution of the Execution Code N RTC ticks in the future. Hence, if you call fwScheduleTask(N) in Initialization Code, then Execution Code will execute N RTC ticks in the future. If you keep calling fwScheduleTask(N) in the Execution Code, then the running Execution Code will keep schedule itself and hence run continuously.

    Edit:

    Also, it does not matter if fwScheduleTask() is called first or last in Initialization Code or Execution Code. fwScheduleTask() takes effect after the running code finishes.

  • Severin

    Thank you. The sensor controller is now looping and the i2c logic is perfect.

    The problem as you suspected was the SCS code; the solution was to transfer the task code from the execution code block to an event handler and place a fwScheduleTask(1) as the single line for the execution code.However I'm not convinced the fwScheduleTask(1) isn't really looping the sensor controller task. It's almost like there are two different semaphores for one task, and it's actually TIMER1 blocking the sensor task?

    It appears to me the RTC is no longer needed since TIMER1 is now triggering the nested event handler code. If so, would you mind clarifying why the event handler code option is nested within the execution code? Is this a method used to mimic semephores and tasks in RTOS but within the low power sensor controller?

    The SCS initialization code initializes the i2c sensor, and does not contain the fwScheduleTask() as it has been commented out for now. The initialization readies the i2c sensor for register reading. I'll debug without the RTC-Based Execution Scheduling next because it seems to be redundant. Is this correct?

    SCS initialization code:

    // boot and reset the VEML 6075 chipset
    i2cStart();
    i2cTx(I2C_OP_WRITE | V6075_I2C_ADDR);
    i2cTx(V6075_CFG_REGISTER);
    i2cTx(V6075_CFG_100_HD_AF_PO); //Sensor Controller Studio i2c bit bang always sends low byte, never high byte
    i2cTx(V6075_CFG_100_HD_AF_PO >> 8); //Sensor Controller Studio i2c bit bang always sends low byte, never high byte
    i2cStop();
    
    
    // VEML6075 Device ID
    i2cStart();
    i2cTx(I2C_OP_WRITE | V6075_I2C_ADDR);
    i2cTx(V6705_REG_RESULT_DEVICEid);
    // If successful
    if (state.i2cStatus == 0x0000) {
        
        U16 resultRegL;
        U16 resultRegH;
        
        // Read the result
        i2cRepeatedStart();
        i2cTx(I2C_OP_READ | V6075_I2C_ADDR);
        i2cRxAck(resultRegL);
        i2cRxNack(resultRegH);
        i2cStop();
        
        U16 IDvalue = (resultRegH << 8) | (resultRegL);
        state.deviceID = IDvalue;
    }   else {
        i2cStop();
    }
    
    // Schedule the first execution
    //fwScheduleTask(1);

    CCS code

    ...

    /* Sensor Controller Iteration calls */
    void scifINIT(void)
    {
    
        // Run initialization code for "scif6075i2c" Sensor Controller task one time
           if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
               //... Handle timeout or usage error ...
           } else if (scifStartTasksNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
               //... Handle usage error ...
           }
    
    } // scifINIT END

    ...

    scifINIT(); // run initialization code for scif and activate sensor controller
        //scifEXEC();
        //scifTERM();
        //scifONCE();
        //scifDATA();

    BIOS_start();
    return(0);
    
        /*scifStartRtcTicksNow(0x00010000/ rtc_Hz);–
         * Can only be used if the RTC-BasedExecutionSchedulingtask resource has been included in SCS.–
         * Starts the real-time clock with a frequency of rtc_HzHz.–
         * Use fwScheduleTask(N)to schedule the execution code N rtc ticks ahead.
         * NOTE:fwScheduleTask(N)is necessary in both the initialization and execution code of the SC.
         * It is a good idea to keep N as low as possible and rtc_Hzat the desired wake-up frequency in order to reduce unnecessary wake-ups.*/

    Thank you, I appreciate your time and comments!

    Patrick

  • Could you please share your Sensor Controller Studio project here?

    If you are using Event Handler Code, then you are not using RTC scheduling. Hence, you don't need fwScheduleTask().
  • Severin

    Thank you for the clarification. Let me share the SCS code, starting w/ the initialization...

    // boot and reset the VEML 6075 chipset
    i2cStart();
    i2cTx(I2C_OP_WRITE | V6075_I2C_ADDR);
    i2cTx(V6075_CFG_REGISTER);
    i2cTx(V6075_CFG_100_HD_AF_PO); //Sensor Controller Studio i2c bit bang always sends low byte, never high byte
    i2cTx(V6075_CFG_100_HD_AF_PO >> 8); //Sensor Controller Studio i2c bit bang always sends low byte, never high byte
    i2cStop();
    
    
    // VEML6075 Device ID
    i2cStart();
    i2cTx(I2C_OP_WRITE | V6075_I2C_ADDR);
    i2cTx(V6705_REG_RESULT_DEVICEid);
    // If successful
    if (state.i2cStatus == 0x0000) {
        
        U16 resultRegL;
        U16 resultRegH;
        
        // Read the result
        i2cRepeatedStart();
        i2cTx(I2C_OP_READ | V6075_I2C_ADDR);
        i2cRxAck(resultRegL);
        i2cRxNack(resultRegH);
        i2cStop();
        
        U16 IDvalue = (resultRegH << 8) | (resultRegL);
        state.deviceID = IDvalue;
    }   else {
        i2cStop();
    }
    // Schedule the next execution
    fwScheduleTask(1);

    ,,, then the execution code,

    // Read the result after ~100 milliseconds + a 20% margin
    evhSetupTimer1Trigger(0, 120, 2);
    
    // Schedule the next execution
    fwScheduleTask(1);

    ,,, the event handler code,

    ... snip ...

        i2cRxAck(resultRegL);
        i2cRxNack(resultRegH);
        i2cStop();
        
        U16 value = (resultRegH << 8) | (resultRegL);
        output.IFR = value;
        
    } else {
        i2cStop();
    }

    Best regards,

    Patrick

  • Severin,

    The CCS code. At the moment I am also moving code from MUTEC.C example to the project so as to prepare RF transfer of the SC data to another CC1310 using semaphores/tasks, but at the moment, Board_init() is interfering w/ the scif initialization. This is why the Mutex.c code is present in the project. I might add that Board_init() in mutex.c is not required code in the mutex.c example.

    /*
     *  ======== main_tirtos.c ========
     */
    
    /* XDC module Headers */
    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
    
    /* BIOS module Headers */
    #include <ti/sysbios/BIOS.h>
    #include <ti/sysbios/knl/Clock.h>
    #include <ti/sysbios/knl/Task.h>
    #include <ti/sysbios/knl/Semaphore.h>
    
    /* V0.2A Board Header files */
    #include "Board.h"
    
    /* Stack size in bytes */
    #define TASKSTACKSIZE    512
    
    Void task1Fxn(UArg arg0, UArg arg1);
    Void task2Fxn(UArg arg0, UArg arg1);
    
    Int resource = 0;
    Int finishCount = 0;
    UInt32 sleepTickCount;
    
    Task_Struct task1Struct, task2Struct;
    Char task1Stack[TASKSTACKSIZE], task2Stack[TASKSTACKSIZE];
    Semaphore_Struct semStruct;
    Semaphore_Handle semHandle;
    
    /*
    ===================================================================================================
    SENSOR CONTROLLER Modules
    =========================
    */
    /* Sensor Controller header files*/
    #include "scif.h"
    
    /* Bitmask for scif task toggle */
    #define BV(x)    (1 << (x))
    
    /* i2c6075 Sensor Controller data register structure and pointer*/
    struct i2c6075DataRegister {int UVA; int UVB; int VIS; int IFR;};
    struct i2c6075DataRegister *p6075;
    
    /* i2c6075 Sensor Controller registers */
    /* UVA, UVB, UVcomp1 (visible light noise), and UVcomp2 (infra-red noise) */
    void Data_scif6075(i2c6075)
    {
        while (1) {
            //semaphore_pend(scifReadData, BIOS_WAITFOREVER);
            p6075->UVA = scifTaskData.scif6075i2c.output.UVA;
            p6075->UVB = scifTaskData.scif6075i2c.output.UVB;
            p6075->VIS = scifTaskData.scif6075i2c.output.VIS;
            p6075->IFR = scifTaskData.scif6075i2c.output.IFR;
        }
    }
    
    void scifRSTD(void)
    {    // Reset all data structures except configuration
          scifResetTaskStructs(1 << SCIF_SCIF6075I2C_TASK_ID, (1 << SCIF_STRUCT_INPUT) | (1 << SCIF_STRUCT_OUTPUT));
    }
    
    /* Sensor Controller HWI calls */
    void scCtrlReadyCallback(void)
    { } // scCtrlReadyCallback
    void scTaskAlertCallback(void)
    { } // scTaskAlertCallback
    
    /* Sensor Controller Iteration calls */
    void scifINIT(void)
    {
    
        // Run initialization code for "scif6075i2c" Sensor Controller task one time
           if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
               //... Handle timeout or usage error ...
           } else if (scifStartTasksNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
               //... Handle usage error ...
           }
    
    } // scifINIT END
    
    void scifEXEC(void)
    {
    
        // Run "scif6075i2c" Execution Code one time
    if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
     //   ... Handle timeout or usage error ...
    } else if (scifSwTriggerExecutionCodeNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
     //   ... Handle usage error ...
    }
    
    } // scifEXEC END
    
    void scifTERM(void)
    {
    
        // Run termination code for "scif6075i2c" Sensor Controller task one time
        if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
            //... Handle timeout or usage error ...
        } else if (scifStopTasksNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
            //... Handle usage error ...
        }
    
    } // scifTERM END
    
    void scifONCE(void)
    {
    
        // Run initialization code, execution code and termination code for "scif6075i2c" Sensor Controller task one time
        if (scifWaitOnNbl(20000) != SCIF_SUCCESS) {
            //... Handle timeout or usage error ...
        } else if (scifExecuteTasksOnceNbl(1 << SCIF_SCIF6075I2C_TASK_ID) != SCIF_SUCCESS) {
            //... Handle usage error ...
        }
    
    } // scifONCE END
    
    /*
    =========================
    SENSOR CONTROLLER Modules
    ===================================================================================================
    */
    
    
    int main(void)
    {
        /*
         ================================
         SENSOR CONTROLLER INITIALIZATION
         ================================
        */
    
        /* Initialize the Sensor Controller hardware */
           scifInit(&scifDriverSetup);
    
        /* Initialize HAL for Sensor Controller (for HWI calls) */
        //scifOsalInit();
        //scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        //scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    
        /* Set the Sensor Controller task tick interval */
            uint32_t rtc_Hz = 4;  // Hz RTC Select 1 to 8 for uVuC light flashes
            scifStartRtcTicksNow(0x00010000 / rtc_Hz);
        /*  Sensor Controller functions */
            scifINIT();
            //scifEXEC();
            //scifTERM();
            //scifONCE();
            //scifDATA();
    
        /*
         ====================================
         END SENSOR CONTROLLER INITIALIZATION
         ====================================
        */
    
            /* Construct BIOS objects */
            Task_Params taskParams;
            Semaphore_Params semParams;
    
            /* Call driver init functions */
            //Board_init();
    
            /* Construct writer/reader Task threads */
            Task_Params_init(&taskParams);
            taskParams.stackSize = TASKSTACKSIZE;
            taskParams.stack = &task1Stack;
            taskParams.priority = 1;
            Task_construct(&task1Struct, (Task_FuncPtr)task1Fxn, &taskParams, NULL);
    
            taskParams.stack = &task2Stack;
            taskParams.priority = 2;
            Task_construct(&task2Struct, (Task_FuncPtr)task2Fxn, &taskParams, NULL);
    
            /* Construct a Semaphore object to be use as a resource lock, inital count 1 */
            Semaphore_Params_init(&semParams);
            Semaphore_construct(&semStruct, 1, &semParams);
    
            /* Obtain instance handle */
            semHandle = Semaphore_handle(&semStruct);
    
            /* We want to sleep for 10000 microseconds */
            sleepTickCount = 10000 / Clock_tickPeriod;
    
            BIOS_start();    /* Does not return */
            return(0);
        }
    
    /*
     *  ======== task1Fxn ========
     */
    Void task1Fxn(UArg arg0, UArg arg1)
    {
        UInt32 time;
    
        for (;;) {
            System_printf("Running task1 function\n");
    
            if (Semaphore_getCount(semHandle) == 0) {
                System_printf("Sem blocked in task1\n");
            }
    
            /* Get access to resource */
            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
    
            /* Do work by waiting for 2 system ticks to pass */
            time = Clock_getTicks();
            while (Clock_getTicks() <= (time + 1)) {
                ;
            }
    
            /* Do work on locked resource */
            resource += 1;
            /* Unlock resource */
    
            Semaphore_post(semHandle);
    
            Task_sleep(sleepTickCount);
        }
    }
    
    /*
     *  ======== task2Fxn ========
     */
    Void task2Fxn(UArg arg0, UArg arg1)
    {
        for (;;) {
            System_printf("Running task2 function\n");
    
            if (Semaphore_getCount(semHandle) == 0) {
                System_printf("Sem blocked in task2\n");
            }
    
            /* Get access to resource */
            Semaphore_pend(semHandle, BIOS_WAIT_FOREVER);
    
            /* Do work on locked resource */
            resource += 1;
            /* Unlock resource */
    
            Semaphore_post(semHandle);
    
            Task_sleep(sleepTickCount);
    
            finishCount++;
            if (finishCount == 5) {
                System_printf("Calling BIOS_exit from task2\n");
                BIOS_exit(0);
            }
        }
    }
    

    Thanks Severin!

    Patrick

  • You are configuring the RTC, and you are using fwScheduleTask(), so it seems like you are using RTC scheduling.

    Also, why did you comment out the following lines?

        //scifOsalInit();
        //scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
        //scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
  • Severin, it is my understanding that ..Osal.. is an abstraction layer useful to HWI only, and using HWI is not required when going the task/semaphore option. Is my presumption incorrect?

    My goal is to have the SC entirely autonomous, and not rely upon the main uC waking up for months on end. When you have time, would you please explain the general overview and necessity of the following SCS code? It appears redundant to me; using one or the other, the RTC or the internal SC timers is best, and not both. Are these dependent upon each other to properly function?

    // Read the result after ~100 milliseconds + a 20% margin
    evhSetupTimer1Trigger(0, 120, 2);

    // Schedule the next execution
    fwScheduleTask(1);

    Thank you Severin for your awesome insights!
    Patrick
  • There are no such guarantees that OSAL is only useful for HWI. As a matter of fact, OSAL contains internal functions used by the SCIF driver framework, and not initializing OSAL essentially makes your program rely on undefined behavior. Also, there are no negative side effects of initializing OSAL.

    As I've already said, you can use either the RTC or event trigger to schedule the next execution of your Sensor Controller Task. You are using both, which means you can choose either for whatever suits your purpose. This is explained in more detail in the SimpleLink Academy lab "Fundamentals" for the Sensor Controller.
  • Severin Suveren said:
    There are no such guarantees that OSAL is only useful for HWI. As a matter of fact, OSAL contains internal functions used by the SCIF driver framework, and not initializing OSAL essentially makes your program rely on undefined behavior. Also, there are no negative side effects of initializing OSAL.

    Thank you Severin! I'll look into the OSAL and initialize it for the scif framework. Updates to follow...

  • DEBUG COMMENTS:

    Severin,

    What does the AUX Timer 1 error mean from the screenshot below? I was just cautiously poking around and noticed the AUX TIMER warning pop up when I had the timer 1 event trigger already set and tried to add the TIMER 1. I've not had a chance to read into it, but thought it might be a clue into why the Sensor Controller won't iterate.

    The Real Time Clock RTC has been removed from the Sensor Controller Studio SCS setup, since I am trying to use the entirely autonomous function of the Sensor Controller (SC) of the microcontroller (uC). The Code Composer Studio (CCS) compiles and flashes the uC, and the initialization code from SCS export is logically correct during flash. Of course 2 logic bursts occur on the board (now using a launchpad CC1310 to make certain this dodgy bug is not hardware). The logic bursts are 1. board reset and 2. initialization code from SCS. So, it appears that the autonomous function of the evhSetupTimer1Trigger(0,120,2) will not start and iterate for some reason. To be clear, I want to use the event trigger of the Sensor Controller uC only, not the RTC of the main uC.

    The SCS task is running fine, as mentioned previously the initialization code and the event handler code is logically perfect, as is the termination code. The SCS task iterates using

    // Read the result after ~100 milliseconds + a 20% margin

    evhSetupTimer1Trigger(0, 120, 2);

    // Schedule the next execution

    //fwScheduleTask(1);

    Severin Suveren said:
    There are no such guarantees that OSAL is only useful for HWI. As a matter of fact, OSAL contains internal functions used by the SCIF driver framework, and not initializing OSAL essentially makes your program rely on undefined behavior. Also, there are no negative side effects of initializing OSAL.

    As I've already said, you can use either the RTC or event trigger to schedule the next execution of your Sensor Controller Task. You are using both, which means you can choose either for whatever suits your purpose. This is explained in more detail in the SimpleLink Academy lab "Fundamentals" for the Sensor Controller.

    int main(void)
    {
        /*
         ================================
         SENSOR CONTROLLER INITIALIZATION
         ================================
        */
    
        /* Initialize the Sensor Controller hardware */
           scifInit(&scifDriverSetup);
    
        /* Initialize HAL framework for Sensor Controller */
           scifOsalInit();
           scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
           scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);
    
        /* Set the Sensor Controller task tick interval */
            //uint32_t rtc_Hz = 4;  
            //scifStartRtcTicksNow(0x00010000 / rtc_Hz);
        /*  Sensor Controller functions */
            scifINIT();
            //scifEXEC();
            //scifTERM();
            //scifONCE();
            //scifDATA();
    
        /*
         ====================================
         END SENSOR CONTROLLER INITIALIZATION
         ====================================
        */
    


  • int main(void) { /* ================================ SENSOR CONTROLLER INITIALIZATION ================================ */ /* Initialize the Sensor Controller hardware */ scifInit(&scifDriverSetup); /* Initialize HAL framework for Sensor Controller */ //scifOsalInit(); //scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback); //scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); /* Set the Sensor Controller task tick interval */ //uint32_t rtc_Hz = 4; // Hz RTC Select 1 to 8 for uVuC light flashes //scifStartRtcTicksNow(0x00010000 / rtc_Hz); /* Sensor Controller functions */ scifINIT(); // triggered by SC timer but must call evhSetupTimer1Trigger() //scifEXEC(); // triggered by RTC only, not by SC timer //scifTERM(); //scifONCE(); //scifDATA(); /* ==================================== END SENSOR CONTROLLER INITIALIZATION ==================================== */ ... snip ...

    /* Sensor Controller functions */

    scifINIT(); // triggered by SC timer but must call evhSetupTimer1Trigger()

    //scifEXEC(); // triggered by RTC only, not by SC timer

     

    Summary of findings:

    (from the datasheet) 6.4 Sensor Controller

    The Sensor Controller contains circuitry that can be selectively enabled in standby mode. The peripherals in this domain may be controlled by the Sensor Controller Engine, which is a proprietary power-optimized CPU. This CPU can read and monitor sensors or perform other tasks autonomously; thereby significantly reducing power consumption and offloading the main CM3 CPU.


    Findings:

    1. The Sensor Controller Engine timer does not seem to activate scif Execution Code
    2. The Sensor Controller Engine timer must be activated inside the Initialization Code , which will queue the Event Handler Code
    3. The Sensor Controller Engine timer is a one-shot trigger.
    4. To run the Sensor Controller Engine autonomously , a two step loop must be as follows: evhSetupTimer1Trigger(#evIndex, mant, #exp) is called by Initialization Code, and will queue Event Handler Code, evhSetupTimer1Trigger(#evIndex, mant, #exp) must then be called again by Event Handler Code otherwise the Sensor Controller Engine timer cannot be reactivated if the application leaves main() for BIOS_start();    /* Does not return */.
    5. //scifOsalInit(); //scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback); //scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); is not required

    Patrick