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