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.

RTOS: (CC2640R2F) ADCBuf driver questions

Tool/software: TI-RTOS

Hi,

I want to use the ADCBuf driver, but I have some questions about it.

1) How much time passes between the ADCBuf_convert() call and the first sample being collected?

2) Why is the sampling frequency specified (as an integer) when all other timers in ti-rtos (that I am aware of) are specified by periods (in clock ticks). My concern is that the measurement could go out of sync with the rest of the system which is controlled by timers specified using period rather than frequency. As my application is very time sensitive I need to be sure that this doesn't happen. Does that mean that I can only use period values for the timers that result in integer frequency values? Is the frequency value given to the ADCBuf turned into a period to a period so that rounding the frequency would be good enough?

Kind regards,

Lukas

  • Hi Lukas,

    First of all, the time between the ADCBuf_convert() call and the first sample would be one period of time (sampling freq) plus the code overhead needed to setup the DMA and ADC module before starting. What this means in time is hard to say as you could have a context switch during the setup phase.

    You could look at the ADCBufCC26XX.c source file (<SDK DIR>/source/ti/drivers/adcbuf/*) and try to estimate this if you want, if you are sure that you in your application will never have a pre-emption (no Hwi, Swi or Tasks) it should be quite deterministic.

    Regarding 2, the ADCBuf driver uses the GPTimer hardware to time the sampling. The timer is setup with a period matching the given frequency by recalculating the frequency to a period count. You can see how this is done in the ADCBuf_open() call. To save you the effort, the period count is calculated as: Count = (freq.lo / frequency) - 1 where freq.lo is the system clock (48 000 000).