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.

CC1310: Help on implementation of the SenorController Task needed

Part Number: CC1310

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.h

SensorController_JA.c
/*
 * 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
    }
}

  • Have you checked that the stack size for the sensor controller task is large enough? 

    "Then after some seconds the firmware crashes": Have you managed to find out where exactly the coe get stuck? 

  • Hi TER,

    I doubled the stack, to 1024 bytes, but this doesn't help. 
    I haven't managed yet where the software get stuck, because I loose the connction to the XDS110.

    I see an uninitialized object in the ROV:

    In case of not starting the Sensorcontroller:

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

    I do not have this uninitialized object.

    BR Noge

  • If you set a breakpoint in the sensorcontrollerTask, are you able to find out which object that has been placed on address 0x2000238C? 

    Are all parameters in the calls in this task been defined? An "uninitialized object" could potentially cause issues. 

  • I deactivated the usage of the ADC in the main Application and I got the following:

    So I guess it was the osaTaskAlertIsr what causes troubles. Is it possible to share the ADC modules between the SC and the CortecM3. Is it necessary to close the ADC object in the Cortex M3 bevor I run the SC.

    What is the best way to handle it ?

    BR Noge

  • If you open Sensor Controller Studio and press F1: Go down to the System CPU Communication->Peripheral sharing on how to ensure that you only try to try to access the ADC from one place. 

    But why do you want to access the ADC from both the Sensor Controller and the CM3? 

  • We had some general measuremnt in all our products like temperature and VCC. This we did in CM3. This is the first time we use the SC because we have to analyze a sin(x) voltage and I think it is better to do in the SC so the CM3 is not loaded to much beside all other application stuff.

  • Have you considered using the BATMON module to read out temp and VDDS?