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.

CC2640 ADC reading in a particular time interval

In our application, we have to trigger an ADC reading in a particular time interval which is in order of a few micro seconds. For example, we need to trigger apulse in PWM and need to take the ADC samples after 100 us and 150 us from there. For this, is it possible to use sensor controller studio? Or do we need to directly interface with the ADC? if so, is it possible to access the ADC driver directly from our application task?

  • Hi,

    Could anyone help on this?

    What could be the most efficient way to do this? We could access the ADC values using the shared buffer updated by the sensor controller task. But as this may need some synchronization , we were checking for any other methods. Seems we could share the ADC of the sensor controller or we could use some API's to directly read the readings from sensor controller.  Could someone please advice which could be the most efficient way for us? We want to trigger an event and read the ADC value after exact 100us.

    Thanks in advance.

    Best Regards,

    Deepa

  • Hello Anil,

    If the PWM pulse is shorter than 100 us you might be able to implement this in SCS by using gpioGenPulseTrain and then setting up ADC AUX timer trigger (refer to the ADC Data Streamer example). You could perhaps set up the aux trigger to 50 us and scratch the first sample. I have not tested this, but it might be something like this:

    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_AUX_TIMER0); // Enable the ADC
    adcStartAuxTimer0Trigger(50);   // Start ADC trigger timer at 20 kHz
    
    gpioGenPulseTrain (???)
    
    // Wait for the next ADC sample and store it
    U16 n = state.head;
    adcReadFifo(output.pSamples[n]);
    ....