Hi,
as mentioned in a previous ticket I'm developing a successor to one of our products.
One important feature is that we can change pin functions anytime. (output, input, pwm, ain, ...)
Because of this the devicetree isn't the way to go for us and we are trying to solve as much as possible with the nrfx api.
A problem we are face right now is that the SAADC causes a high power consumption after uninitializing it.
Instead of returning to 10-20µA it stays at around 650µA.
We are doing the following: configuring the saadc, triggering one measurement in blocking mode and deactivating/deconfiguring the saadc again.
int32_t ADC_ConvertSingleADC(TADC_AInput eAdcCAIn, TADC_AcqTimeUs eAdcAcqTimeUs, TADC_Res eAdcResolution)
{
int32_t iErr;
int16_t s16SampleBuffer;
nrfx_saadc_adv_config_t adc_config = NRFX_SAADC_DEFAULT_ADV_CONFIG;
nrfx_saadc_channel_t channel_config = NRFX_SAADC_DEFAULT_CHANNEL_SE((eAdcCAIn), 0);
channel_config.channel_config.gain = psADC_Cfg->eGain;
channel_config.channel_config.reference = psADC_Cfg->eRefType;
channel_config.channel_config.acq_time = eAdcAcqTimeUs;
nrfx_saadc_init(7);
iErr = nrfx_saadc_channel_config(&channel_config);
if(iErr != NRFX_SUCCESS)
return(0);
iErr = nrfx_saadc_advanced_mode_set((0x01), eAdcResolution, &adc_config, NULL);
if(iErr != NRFX_SUCCESS)
return(0);
iErr = nrfx_saadc_buffer_set(&s16SampleBuffer, sizeof(s16SampleBuffer)/sizeof(int16_t));
if(iErr != NRFX_SUCCESS)
return(0);
iErr = nrfx_saadc_mode_trigger();
if(iErr != NRFX_SUCCESS)
return(iErr);
nrfx_saadc_uninit();
nrfx_saadc_channels_deconfig(0x01);
return(s16SampleBuffer);
}
Any idea what the problem could be?
I've tested this with nRF Connect SDK version 1.8.0 and 2.0.2.
Kind Regards
Johannes