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.

CC2650: CC2650 sensor Controller Freeze

Part Number: CC2650


Hello,

I designed a sensor controller task to measure every millisecond the voltage on one GPIO between a start and a stop given by the main system CPU application. The task provides the minimum voltage between the start and the stop.

The problem is that the application is working fine on debug mode, but freezes when not in debug. It seems to freeze at the start.

See below the sernsorcontroller task and application code

INITIALIZATION CODE :

// Select ADC input
adcSelectGpioInput(AUXIO_A_VBATT);

// initiizes vbattMin to a maximum value
output.vbattMin = VBATT_MAX;
input.stopRequired = 0;

// Enable the ADC (fixed reference, 2.7 us sample time, manual trigger)
adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);

// Schedule the first execution
fwScheduleTask(1);

EXECUTION CODE :

// Sample the sensor
U16 adcValue;
adcGenManualTrigger();
adcReadFifo(adcValue);

// Determaine the minimum value
if (adcValue < output.vbattMin) {
    output.vbattMin = adcValue;
}

// Schedule the next execution
ifnot (input.stopRequired == 1) {
    fwScheduleTask(1);
}

TERMINATION CODE :

// Disable the ADC
adcDisable();

ON THE APPLICATION SIDE :

The driver is initialized by:

    // Initialize the SCIF operating system abstraction layer
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);

    // Initialize the SCIF driver
    scifInit(&scifAexVbattDriverSetup);

    // Enable RTC ticks, with 1000 Hz tick interval
    scifAexVbattStartRtcTicksNow(0x00000041);

The measurement sequence is started by :

    // Initialize the SCIF operating system abstraction layer
    scifOsalInit();
    scifOsalRegisterCtrlReadyCallback(scCtrlReadyCallback);
    scifOsalRegisterTaskAlertCallback(scTaskAlertCallback);

    // Initialize the SCIF driver
    scifInit(&scifAexVbattDriverSetup);

    // Enable RTC ticks, with 1000 Hz tick interval
    scifAexVbattStartRtcTicksNow(0x00000041);

The Measurement is read by

    int32_t adcOffset = AUXADCGetAdjustmentOffset(AUXADC_REF_FIXED);
    int32_t adcGainError = AUXADCGetAdjustmentGain(AUXADC_REF_FIXED);
    int32_t adcValue, adcCorrectedValue, adcValueMicroVolt;

    // Read ADC value
    adcValue = scifAexVbattTaskData.vbattMonitor.output.vbattMin;

    // Correct ADC raw value
    adcCorrectedValue = AUXADCAdjustValueForGainAndOffset((int32_t) adcValue, adcGainError, adcOffset);

    // Convert ADC value to Micro Volts.
    adcValueMicroVolt = AUXADCValueToMicrovolts(AUXADC_FIXED_REF_VOLTAGE_NORMAL,adcCorrectedValue);

And the measurement sequence is stopped by :

   uint8_t result;

    // Stops the "VbattMonitor" Sensor Controller task
    scifAexVbattTaskData.vbattMonitor.input.stopRequired = 1;
    result = scifStopTasksNbl(1 << SCIF_AEX_VBATT_VBATT_MONITOR_TASK_ID);