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.

How to trigger the ADC with RTC and have DMA to move the sampled data??

Other Parts Discussed in Thread: CC2650

Hello dear friends,

I'm currently using GPT0A to trigger the ADC asynchronously in cc2650 and after that I use DMA for moving the sampled data into a specific location in memory. Now the timer module consumes to much power and I intent to lower it using the RTC. I believe that since all of the BLE time sensitive tasks are controlled trough the RTC, using it would be less energy consuming instead of using the GPT. 

I don't know if it is possible to trigger the ADC with RTC and then use DMA to move the data? How should I implement this?? any other ideas to lower the dc power consumption would be appreciated.

Thanks in advance for your respond,

Helene Segara

  • Another option is using sensor controller studio. You can use an AUX timer to trigger ADC. You can take a look at analog-light-sensor project.

    check out these functions :

    adcEnableAsync(#refSource, #trigger);
    adcStartAuxTimer0Trigger(#period);
  • Hi Helene,

    ADC should consume much more power than GPTimer. I don't think it is an issue to use GPTimer as the trigger source of ADC. Timer is just a counter, you know. I don't think there will be much difference to use RTC or AUX Timer.

    The root problem is the uDMA of CC26xx is not efficient at all. It can only move 3 elements from ADC FIFO each time. Then, in the uDMA ISR, you have to setup the next uDMA transfer parameter for the next 3 elements. So, the CPU will be waked up to service uDMA ISR for every 3 ADC samples.

    In my experience, an efficient DMA should be able to move one element for each ADC sample-completed event. e.g. If we define a 1024-element buffer for DMA, then the DMA interrupt is only needed to service for every 1024 elements (instead of 3). It is a pity that this is not applicable for CC26xx.

    After spending lots of time on studying CC26xx uDMA and AUXADC. I realize why TI always suggest us to use sensor controller engines (SCE). The fact is the uDMA is totally useless. I don't know why TI design uDMA in this way.

    The original idea of SCE is to shutdown CPU and use SCE to deal with some background stuff such as ADC. But "shutdown CPU" is not efficient due to the delay time to wake it up again. This is especially true for high-speed ADC sampling cases because the CPU must be waked up to do something after a very short time period even SCE is used.

    SCE will also make the project maintenance complicated because you have to deal with two compilers, one in CCS and the other in SCE Studio.

    SCE is a good idea for some cases. But it also makes things complicated. Honestly speaking, I don't like it. But it seems the only way you can do to reduce power consumption on CC26xx.
  • Does This mean that using AUX timer or RTC will reduce my power consumption?
  • Hi rcfocus,
    Thanks for replying. Actually when I turn off the timer my the ADC stops working. therefore the reduction in power is some how nebulous. It isn't clear wether it is because of the timer ,or ADC,or DMA. However, when I only comment out the DMA initialization where the timer and ADC still work, not much power reduction is observed. So I am still not sure that the DMA is consuming all of the power. This is also true for ADC. when I comment out the ADC initialization, the same thing happens, not much reduction in power.
    So can you provide me with some more examinations to convince me that DMA is the problem here. I know that timer is a counter, but the fact is, it works with a clock source which is much higher than the RTC clock source. Thus, I expect the timer to be much more power consuming than the RTC. wouldn't you agree with me?? I think this is why TI, itself, uses RTC for handling BLE time sensitive tasks.

    Despite this fact, I don't understand the sensor controller compiler, SCE. How should I get started to implement my applications. I need to control the ADC sampling rate based on the signal which I'm sampling and the move the sampled data to a specific location in memory without calling the CPU. Some documents and examples about the functionality of the sensor controller would be a useful.

    Thank you,
    Helene.

  • Hi Helene,

    I don't think you will observe much power difference between using ADC ISR and DMA ISR. The DMA interrupt count is still 1/3 of ADC due to the uDMA of CC26xx is not well designed. This means CPU (M3) is still waked up too often.

    No matter GPTimer or AUX Timer is used, the clock sources are all from HFCLK (48MHz). So, clock source is not the root cause. The key point to save power is: Let CPU sleep whenever possible. This is what SCE designed for. SCE is actually a very simplified CPU. It is very power-efficient compared to M3 (main CPU). When you use SCE to do ADC sampling stuff, the main CPU (M3) can go to in sleep state. This is how it saves power.

    TI-RTOS uses RTC as kernel clock source for some reasons. In fact, M3 has a built-in 24-bits ticker. The major benefit of using 40-bits (?) RTC timer is to support very long sleep time with tick-suppression technique. The other reason is the RTC should be enabled in most cases, then why not use it. There are also disadvantages to use RTC as kernel ticker. For example, the kernel is less portable for other Cortex-M CPU.

    In summary, I would recommend you to use SCE for maximum power saving requirement. But if power is not so critical, then it will be much easier to use GPTimer + ADC ISR.

    To use SCE, you have to learn SCE Studio which can be downloaded from TI website.

  • Christin Lee said:
    Another option is using sensor controller studio. You can use an AUX timer to trigger ADC. You can take a look at analog-light-sensor project.

    check out these functions :

    adcEnableAsync(#refSource, #trigger);
    adcStartAuxTimer0Trigger(#period);

    Sorry for the non related question, but this seemed to be an acceptable topic.

    The project involves sampling thorugh the ADC one channel every 100 ms, saving data in a buffer and then sending it via BLE.

    My question is: can I using the SensorTag source code from CCS (because it has libraries and already works) and copy in it code from Sensor Controller Studio?

    Basically the code would be this

    // Select ADC input
    
    adcSelectGpioInput(AUXIO_A_SENSOR_OUTPUT);
    // Enable the ADC (fixed reference, 2.7 us sample time, manual trigger)
    adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_AUX_TIMER0);
    // Sample the sensor and store the ADC value
    adcStartAuxTimer0Trigger(50);
    adcReadFifo(output.adcValue);
    // Disable the ADC
    adcDisable(); 

    Which is copied from a Controller Studio example. Will it work? Or will libraries be missed? 

  • You also need to include the sensor controller driver code into the project.

    Please take a look at this sticky post about sensor controller studio.
    e2e.ti.com/.../495518