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.

LAUNCHXL-CC26X2R1: Sensor Control can't run for more than 5 minutes

Part Number: LAUNCHXL-CC26X2R1

Hi

We use the Timer 1 Event Trigger to sample the ADC value and alert the main application when 120 samples are reached.

It started to run normally, but after some time(No more than 5 minutes), the sensor control will not alert the main application, but the main application still runs normally.

Please see the following code in detail:

//Initialization code

gpioClearOutput(AUXIO_O_GREEN_LED);

// Schedule the first execution
evhSetupTimer1Trigger(0, 128, 5); //1 Second


//Event Handler

// Select ADC input
adcSelectGpioInput(AUXIO_A_ADC_INPUT);
// Enable the ADC 
adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);


adcGenManualTrigger();
U16 n = state.count;

adcReadFifo(output.adcTest);


state.count += 1;

//Reset the count
if (state.count == (BUFFER_SIZE)) {
    state.count = 0;
}




if (n == (BUFFER_SIZE-1)) {
    //For LED debug
    state.test = ~state.test;
    if (state.test == 0) {
        gpioClearOutput(AUXIO_O_GREEN_LED);
    } else {
        gpioSetOutput(AUXIO_O_GREEN_LED);
    }

    fwGenAlertInterrupt();
}

adcFlushFifo();

// Disable the ADC
adcDisable();


evhSetupTimer1Trigger(0, 2, 0); //2K Sample Rate

SDK Version : 3.40

Sensor Control Studio Version : 2.6

Do you have any suggestions for us?

Thanks.

BR

Trevor

  • Hi Trevor,

    How do you verify the Sensor Controller task has stopped? If you manually read the state variable from the task struct in your application, does it still update?

    What if you drastically decrease the sampling rate from 2 kHz to, say, half a second? Does the program still hang?

  • Hi Severin,

    You can check the previous SC code, it will alert the main application and blink the green LED.

    In main application, we also add debug message into scTaskAlertCallback();

    Please see the following main application code:

    //Main Application 
    
    void processSCTaskAlert(void)
    {
        scifClearAlertIntSource();
    
        Log_info0("SC_CTRL_ALERT");
    
        // Acknowledge the ALERT event
        scifAckAlertEvents();
    }
    
    
    void scTaskAlertCallback(void)
    {
        processSCTaskAlert(void)
    } // scTaskAlertCallback

    We will set 0.5S sample rate and update the result for you.

    Thanks

    BR

    Trevor

  • Hi Severin,

    Regarding 500mS experiment, we have already run it on the Lanuch-Pad, but we think it will take some time for monitoring. If we complete the experiment, we will update result for you.

    BTW, about SC code(2K sampling rate), if we comment the ADC part, the SC works normally and doesn't stop.

    Thanks.

    BR

    Trevor

  • Hi Severin,

    Update the test result for you, the SC stops running after about ten hours.

    So we think that the reason why the SC stops running has nothing to do with the sampling rate(Should be more related to ADC).

    Could you help us to check this issue?

    Thanks.


    BR

    Trevor

  • Are you using the ADC in your main application at any point?

  • Hi Severin,

    We used the original SDK example(project_zero), we don't make any modifications for this example, we just add the SC function into this project.

    Thanks.

    BR

    Trevor

    
    
  • Could you please try to use the sensor controller example in an bare bone example, such as the "empty" example, and see if the problem still occurs?

    My hunch here is that the project zero example is using some peripheral that is affecting the usage of your SC project.

  • Hi Severin,

    We use another SC project(ADC Data Streamer) and make some modifications(the behavior is the same with the previous SC project).

    This example uses timer0 to trigger the ADC and the SC always remains in active mode.

    Please see the following code:

    //Execution Code
    // Select ADC input
    adcSelectGpioInput(AUXIO_A_SENSOR_OUTPUT);
    
    // Enable the ADC
    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_AUX_TIMER0);
    
    
    timer0Start(TIMER0_MODE_PERIODICAL, 12000, 0); //2K sampling rate
    
    
    // Loop until the application sets the exit flag
    while (state.exit == 0) {
        
        
        U16 n = state.head;
    
        adcReadFifo(output.adcTest);
    
        state.count += 1;
    
        //Reset the count
        if (state.count == (BUFFER_SIZE)) {
            state.count = 0;
        }     
    
    
        if (n == (BUFFER_SIZE-1)) {
            //For LED debug
            state.test = ~state.test;
            if (state.test == 0) {
                gpioClearOutput(AUXIO_O_GREEN_LED);
            } else {
                gpioSetOutput(AUXIO_O_GREEN_LED);
            }
    
            fwGenQuickAlertInterrupt();
        }  
    }
    
    // Stop the ADC trigger and flush the ADC FIFO
    timer0Stop();
    adcFlushFifo();
    
    // Disable the ADC
    adcDisable();

    We could try the SC code into empty project and will update the result for you.

    Thanks.

    BR

    Trevor

  • Hi Severin,

    Update test results: the issue didn't occur in the empty project, we also tried another ble5stack project(simple peripheral), the issue will also occur for simple peripheral project.

    After some debugging, we found that the key point function is GapAdv_enable(), if we don't enable the advertising, the SC works normally and doesn't stop.

    We have verified on project_zero & simple_peripheral projects, it works.

    We need these two functions(ble5stack &  SC), could you help us to check this issue?

    Thanks.

    BR

    Trevor

  • Trevor,

    I was able to reproduce your issue with the SC code you provided and Project Zero.

    It seems like the SC hangs when calling adcReadFifo() for some reason, which causes the entire SC to stop.

    I'm not entirely sure why this is happening, but it could be that when adcGenManualTrigger() is called after ADC is enabled, that ADC is not ready to be triggered. If this is the case, then reading the FIFO will block forever because no ADC reading will occur. Now of course, this is a bug if this is the case.

    We observed that by introducing a small delay between adcEnableSync() and adcGenManualTrigger() seemed to stop the issue.

    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);
    
    // Workaround?
    fwDelayUs(1);
    
    adcGenManualTrigger();

    Could you please test this out?

    We are internally looking into this to see if this is the bug or not, and if so we will release a patch.

  • Hi Severin,

    Thanks for your workaround solution, it works.

    If you have any update about this issue, please let us know.

    Thanks.

    BR

    Trevor