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

SAADC on SDK12.3

I've recently migrated from SDK11 to SDK12.3 to take advantage of the low power option. However I still am having weird issues with power consumption. I have a feature which enabled ADC measurement. When this feature gets turned off I unint the SAADC module, but power consumption seems to remain quite high (~3-4mA). I've traced this consumption to the moment SAADC is enabled.

Here's a quick snapshot of my saadc init code:

nrf_drv_saadc_config_t saadc_config;
nrf_saadc_channel_config_t channel_config =  
NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(input_adc_pin);
channel_config.acq_time = NRF_SAADC_ACQTIME_5US; 

//Configure SAADC
saadc_config.low_power_mode	= true;
saadc_config.resolution = NRF_SAADC_RESOLUTION_14BIT; 
saadc_config.oversample = NRF_SAADC_OVERSAMPLE_DISABLED; 
saadc_config.interrupt_priority = APP_IRQ_PRIORITY_LOW;     

if( my_saad_config.saadc_initialized ) return;

err_code = nrf_drv_saadc_init(&saadc_config, my_saadc_callback);
my_adc_error_check(err_code,11);

err_code = nrf_drv_saadc_channel_init( 0, &channel_config );
my_adc_error_check(err_code,12);


nrf_saadc_channel_config_t channel_config_1 =  NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3);
channel_config_1.acq_time = NRF_SAADC_ACQTIME_5US; 

err_code = nrf_drv_saadc_channel_init( 1, &channel_config_1 );
my_adc_error_check(err_code,21);

my_saad_config.saadc_initialized = true;

For Uninitializing I used the follow:

nrf_drv_saadc_uninit();
NRF_SAADC->INTENCLR = (SAADC_INTENCLR_END_Clear << SAADC_INTENCLR_END_Pos);
NVIC_ClearPendingIRQ(SAADC_IRQn);
my_saad_config.saadc_initialized = false;

Also at times when I tries and Stop/Start the module, the nrf_drv_saadc_sample() always returns a NRF_ERROR_INVALID_STATE error? I am using the Softdevice s132 V3.

Parents
  • Hi,

    When using the low power mode of the SAADC driver in SDK > v12.0.0, it will automatically uninit the peripheral between sampling. Unless you want to disable the interface completely, you should not have to call nrf_drv_saadc_uninit() manually.

    ~3-4 mA sounds too high to come from the SAADC peripheral alone. You will have the EasyDMA current of ~1.5mA and ~700uA extra when sampling, so depending on your sample rate and method of triggering sampling, you should end up at less than 3mA. Are you putting the device in sleep mode whenever possible? Do you power cycle the device after flashing, to make sure it is not in debug mode?

    I recently updated this GitHub example to SDK 13, could you have a look at it and compare it to your application? Could you also upload your entire code for debugging?

    Best regards,

    Jørgen

  • Thats what I figured regarding the low power setting. I recently added the nrf_pwr_mgmt.h module to my project. Added nrf_pwr_mgmt_run(); to the loop in my BLE thread (i used FreeRTOS). This seems to have brought down the power consumption. I'm coming from SDK 11, where only app_sched_execute(); & sd_app_evt_wait(); were required to put the system to low power sleep. Curious as to why this was changed and why its not implemented by default.

Reply
  • Thats what I figured regarding the low power setting. I recently added the nrf_pwr_mgmt.h module to my project. Added nrf_pwr_mgmt_run(); to the loop in my BLE thread (i used FreeRTOS). This seems to have brought down the power consumption. I'm coming from SDK 11, where only app_sched_execute(); & sd_app_evt_wait(); were required to put the system to low power sleep. Curious as to why this was changed and why its not implemented by default.

Children
No Data
Related