Dear DevZone,
I am trying to configure the SAADC on my custom nRF52840 board.
I would like to use it in blocking mode together with oversample 16x and burst enabled.
I started from the example provided in the SDK, and I firstly removed all the parts related to non-blocking mode.
Then I modified the parameters to set oversample and burst mode. Here the steps I performed:
- I modified the configuration struct to enable burst in this way:
#define NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \
{ \
.resistor_p = NRF_SAADC_RESISTOR_DISABLED, \
.resistor_n = NRF_SAADC_RESISTOR_DISABLED, \
.gain = NRF_SAADC_GAIN1_6, \
.reference = NRF_SAADC_REFERENCE_INTERNAL, \
.acq_time = NRF_SAADC_ACQTIME_3US, \
.mode = NRF_SAADC_MODE_SINGLE_ENDED, \
.burst = NRF_SAADC_BURST_ENABLED, \ //enabled burst mode to automatically acquire 2^oversample samples with one request
.pin_p = (nrf_saadc_input_t)(PIN_P), \
.pin_n = NRF_SAADC_INPUT_DISABLED \
}
- I modified the following value in the sdk_config file:
// <0=> Disabled
// <1=> 2x
// <2=> 4x
// <3=> 8x
// <4=> 16x
// <5=> 32x
// <6=> 64x
// <7=> 128x
// <8=> 256x
#ifndef NRFX_SAADC_CONFIG_OVERSAMPLE
#define NRFX_SAADC_CONFIG_OVERSAMPLE 4
#endif
Is the procedure correct? Am I missing something? Do you think there could be any issues related to the buffer size if I use the blocking mode (nrfx_saadc_sample_convert function)?
Thank you very much in advance,
best regard,
Gianluca Milani