Dear all,
I want to use an ADC Channel to read a voltage with the sensor controller. I modified the Sensor Controlller example "ADC window Monitor" and debugged it and it works fine.
Then I tried to implement it to my CCS Project for the my device application. Therfore I generated a new Task:
void sensorsontrollerTask_Init (void) { Task_Params_init(&sensorsontrollerTask_Params); sensorsontrollerTask_Params.stackSize = 512; sensorsontrollerTask_Params.stack = &sensorsontrollerTask_Stack; Task_create((Task_FuncPtr)sensorsontrollerTask,&sensorsontrollerTask_Params,Error_ABORT); }
where I init the Sensor controller Task:
void sensorsontrollerTask (UArg Arg) { // Initialize the SCIF operating system abstraction layer scifOsalInit(); scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback); scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); // Initialize the SCIF driver scifInit(&scifDriverSetup); // Enable RTC ticks, with 100 Hz tick interval scifStartRtcTicksNow(0x00010000 / 100); // Start the "ADC Window Monitor" Sensor Controller task scifStartTasksNbl(1 << SCIF_ADC_WINDOW_MONITOR_TASK_ID); while (1) { Task_sleep(100); // sleep for 1ms } }
After the init the scCtrlReadyCallback is called.
Then after some seconds the firmware crashes. If I do not start the Sensorcontroller, the rest of my application works fine.
BR Noge
/* * SensorController_JA.c * * Created on: 13.04.2021 * Author: E9601483 */ #include <stdbool.h> #include <stdint.h> #include <ti/sysbios/knl/Semaphore.h> #include <ti/sysbios/knl/Task.h> #include <xdc/runtime/Error.h> #include <ti/drivers/PIN.h> #include <ti/sysbios/BIOS.h> #include <xdc/runtime/Error.h> #include "scif.h" #include "scif_osal_tirtos.h" void sensorsontrollerTask (UArg Arg); static char sensorsontrollerTask_Stack[512]; static Task_Params sensorsontrollerTask_Params; static Task_Struct sensorsontrollerTask_Struct; #if defined(__IAR_SYSTEMS_ICC__) __task #elif defined(__TI_COMPILER_VERSION__) #pragma TASK( sensorsontrollerTask ) #endif // SCIF driver callback: Task control interface ready (non-blocking task control operation completed) void scCtrlReadyCallback(void) { scifClearAlertIntSource(); uint16_t uintADCvalue = scifTaskData.adcWindowMonitor.output.adcValue; scifAckAlertEvents(); } // SCIF driver callback: Sensor Controller task code has generated an alert interrupt void scTaskAlertCallback(void) { scifClearAlertIntSource(); uint16_t uintADCvalue = scifTaskData.adcWindowMonitor.output.adcValue; scifAckAlertEvents(); } void sensorsontrollerTask_Init (void) { Task_Params_init(&sensorsontrollerTask_Params); sensorsontrollerTask_Params.stackSize = 512; sensorsontrollerTask_Params.stack = &sensorsontrollerTask_Stack; Task_create((Task_FuncPtr)sensorsontrollerTask,&sensorsontrollerTask_Params,Error_ABORT); } void sensorsontrollerTask (UArg Arg) { // Initialize the SCIF operating system abstraction layer scifOsalInit(); scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback); scifOsalRegisterTaskAlertCallback(scTaskAlertCallback); // Initialize the SCIF driver scifInit(&scifDriverSetup); // Enable RTC ticks, with 100 Hz tick interval scifStartRtcTicksNow(0x00010000 / 100); // Start the "ADC Window Monitor" Sensor Controller task scifStartTasksNbl(1 << SCIF_ADC_WINDOW_MONITOR_TASK_ID); while (1) { Task_sleep(100); // sleep for 1ms } }