After nrfx_saadc_mode_trigger, power consumption raised 1.3mA and not drop.

Hi,

I am working on ncs 2.9.1 @ nRF54L15.

I followed this academy course to add a single channel saadc in simple mode:

	/* STEP 5.1 - Connect ADC interrupt to nrfx interrupt handler */
	IRQ_CONNECT(DT_IRQN(DT_NODELABEL(adc)), DT_IRQ(DT_NODELABEL(adc), priority), nrfx_isr, nrfx_saadc_irq_handler, 0);

	/* STEP 5.2 - Initialize the nrfx_SAADC driver */
	nrfx_err_t err = nrfx_saadc_init(DT_IRQ(DT_NODELABEL(adc), priority));
	if (err != NRFX_SUCCESS) {
		LOG_ERR("nrfx_saadc_mode_trigger error: %08x", err);
		return -1;
	}

	/* STEP 5.3 - Configure the SAADC channel */
	channel.channel_config.gain = NRF_SAADC_GAIN1_4;
	err = nrfx_saadc_channels_config(&channel, 1);
	if (err != NRFX_SUCCESS) {
		LOG_ERR("nrfx_saadc_channels_config error: %08x", err);
		return -1;
	}

	/* STEP 5.4 - Configure nrfx_SAADC driver in simple and blocking mode */
	err = nrfx_saadc_simple_mode_set(nrfx_saadc_channels_configured_get(), NRF_SAADC_RESOLUTION_12BIT, NRF_SAADC_OVERSAMPLE_DISABLED, NULL);
	if (err != NRFX_SUCCESS) {
		LOG_ERR("nrfx_saadc_simple_mode_set error: %08x", err);
		return -1;
	}

	/* STEP 5.5 - Set buffer where sample will be stored */
	err = nrfx_saadc_buffer_set(&sample, 1);
	if (err != NRFX_SUCCESS) {
		LOG_ERR("nrfx_saadc_buffer_set error: %08x", err);
		return -1;
	}
	
	err = nrfx_saadc_offset_calibrate(NULL);
		if (err != NRFX_SUCCESS) {
			LOG_ERR("nrfx_saadc_offset_calibrate error: %08x", err);
			return rc;
		}

		/* Step 7.2 - Trigger the sampling */
		err = nrfx_saadc_mode_trigger();
		if (err != NRFX_SUCCESS) {
			LOG_ERR("nrfx_saadc_mode_trigger error: %08x", err);
			return rc;
		}

		/* STEP 7.3 - Calculate and print voltage */
		int adc_voltage = ((900 * 4) * sample) / ((1<<12));
		int battery_voltage = adc_voltage * 1220 / 220;

		LOG_DBG("SAADC sample: %d Battery Voltage: %d mV", sample, battery_voltage);
	

ADC read works properly, but the current read from PPK2 raised from 30uA to 1.3mA when nrfx_saadc_mode_trigger been called.

How to disable saadc after sampling is triggered?

I tried call nrfx_saadc_abort but the current is still high

Regards,

Anthony

  • Hi Anthony

    We'll get back to you next week with some more input on this issue, but 1.3mA sounds very high (way more than what just the ADC peripheral should draw). Can you show us how you have connected the PPK2 to the nRF54L15 DK? Most likely it's the CPU being left running for some reason after ADC has been called, so you should make sure nothing else is keeping the CPU running. If you have enabled logging that might be it.

    Best regards,

    Simon

  • Thanks for the reply Simon,

    1. I use PPK2 in source meter mode to power my nRF54L15 custom board

    2. I think 1.3mA is normal as I found this post , and I check the nrfx_saadc source code, I think the STOP command is not generated as there is no event handler(the academy example in blocking mode).

    3. I tried the zephyr api in the same academy example: this , it works well and after adc_read, the power consumption go back to below 25uA.

    4. What is the proper way to o disable saadc after sampling is triggered with nrfx_saadc/blocking mode?

    Regards,

    Anthony

  • Hi

    As far as I know the driver should handle the ADC (in simple mode at least) correctly in the latest SDK versions, so I'm struggling to see what this could be, but I guess it could be the blocking mode keeping the ADC running.

    Best regards,

    Simon

  • I'm seeing a similar issue now after updating to NCS SDK 3.1.0. I'm using the Zephyr API as described in the NCS Academy Intermediate course. In NCS SDK 3.1.0 the Zephyr ADC Driver now uses SAADC driver under the hood.

    Came across the answer in this thread:  RE: power consumption increases 1.1mA after first ADC sample 

    TLDR; the ADC peripheral doesn't receive the STOP event.

    Calling nrfx_saadc_abort(); solves the problem for me and the current drops from 1.4mA to basically 0. (few uA)

  • I stumbled on another solution. Sharing it in case it helps anyone else in the future. Increase the ADC acquisition time to 10μs or larger.

    I am using nRF52832, and haven't tested this on nRF54L

    Instead of calling nrfx_saadc_abort() to manually activate the STOP task in the ADC peripheral. What worked also for me is to increase the ADC acquisition time from 3μs to 10μs.

    Another benefit in increasing the acquisition time is it allows the CPU to work in refresh mode. Which means the internal voltage regulator are more efficient.

    To quote docs.nordicsemi.com/.../saadc.html

    > When tACQ is 10us or longer, and if DC/DC is active, it will be allowed to work in refresh mode if no other resource is requiring a high quality power supply from 1V3. If tACQ is smaller than 10us and DC/DC is active, refresh mode will not be allowed, and it will remain in normal mode from the START task to the STOPPED event. So depending on tACQ and other resources' needs, the appropriate base current needs to be taken into account.

Related