This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How does "nrfx_saadc_sample()" work?

Hi I am building a project, where I need to initialize the ADC using a timer. Whenever there is a timer interrupt "nrfx_saadc_sample" gets called and ADC starts sampling. I want to know whether it converts single value or it depends on the buffer size or number of samples? Suppose the timer generates an interrupt at every 100ms, and adc starts sampling. Does it sample only single value read from analog pin or it just stores up the buffer and converts them altogether?

Parents Reply Children
  • Hi,

    From a HW perspective there are separate events for each sample and when the buffer is filled (from PS):

    A DONE event is generated for every single completed conversion, and an END event is generated when multiple samples, as specified in RESULT.MAXCNT, have been written to memory.

    The driver does not enable interrupts for DONE events, so you will not get a SAADC interrupt every time you sample. You can get a timer interrupt if that is configured, but that does not make much sense if you use PPI, unless you also want to do some SW processing at the same interval.

Related