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

SAADC oversampling

I have SAADC configured in burst mode with 4x oversampling and tACQ=5uSec.

What is the total conversion period?

tACQ + tCONV*4 
or
(tACQ+tCONV)*4

In other words, is Sample and Hold performed only once or once for each conversion within the burst? 

  • Hi,

    The last alternative would be the correct one, as the sample will be performed for each conversion. This can be tested by using a PPI to sets up a task that toggles a pin each time a conversion is done. The image shows that the pin is toggled 16 times when an oversample of x16 is used.

    regards

    Jared

    int main(void)
    {
        static int16_t buffer[2];
        static uint32_t event_count = 0;
     
        NRF_SAADC->ENABLE = 1;
        NRF_SAADC->OVERSAMPLE = 4;
        NRF_SAADC->RESULT.PTR = (uint32_t) buffer;
     
        NRF_SAADC->CH[0].PSELN = 0x0;
        NRF_SAADC->CH[0].CONFIG = 0x01020000; // 10us, Burst mode.
     
        NRF_SAADC->CH[0].PSELP = 0x1; // Sample 2 channels.
        NRF_SAADC->RESULT.MAXCNT = 1;
        NRF_SAADC->EVENTS_END = 0;
        NRF_SAADC->EVENTS_CALIBRATEDONE = 0;
        NRF_SAADC->EVENTS_DONE = 0;
    
     
    
        #define PPI_CHANNEL (0)
        #define PIN_GPIO    (27)
    
     
    
        // Configure PIN_GPIO as output
        NRF_GPIO->DIRSET = (1UL << PIN_GPIO);
    
     
    
        // Configure GPIOTE->TASKS_OUT[0] to toggle PIN_GPIO
        NRF_GPIOTE->CONFIG[0] = (GPIOTE_CONFIG_MODE_Task       << GPIOTE_CONFIG_MODE_Pos) |
                                (GPIOTE_CONFIG_OUTINIT_Low     << GPIOTE_CONFIG_OUTINIT_Pos) |
                                (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos) |
                                (PIN_GPIO                      << GPIOTE_CONFIG_PSEL_Pos);
    
     
    
        // Configure PPI channel with connection between TIMER->EVENTS_COMPARE[0] and GPIOTE->TASKS_OUT[0]
        NRF_PPI->CH[PPI_CHANNEL].EEP = (uint32_t)&NRF_SAADC->EVENTS_DONE;
        NRF_PPI->CH[PPI_CHANNEL].TEP = (uint32_t)&NRF_GPIOTE->TASKS_OUT[0];
    
     
    
        // Enable PPI channel
      NRF_PPI->CHENSET = (1UL << PPI_CHANNEL);
     
        while(1){
     
            NRF_SAADC->TASKS_START = 1;
            while(NRF_SAADC->EVENTS_STARTED == 0);
            NRF_SAADC->EVENTS_STARTED = 0;
            NRF_SAADC->TASKS_SAMPLE = 1;
            while(NRF_SAADC->EVENTS_END == 0) 
            NRF_SAADC->EVENTS_END = 0;
     
            event_count++;
            nrf_delay_ms(100);
        }
    }

Related