High sleep power consumption with onewire after migrating to 3.2.1

Hi,

I am developing a low power BLE device using Promicro nRF52840 boards. After updating to ncs3.2.1 I have noticed a high power consumption in sleep, that isn't present with ncs3.1.1. Reading the changelogs and migration guides I am unable to determine what exactly changed. I have put together a simple application that is enough to show a clear difference. When compiling with 3.1.1 the consumption of the whole board is 54 uA, while with 3.2.1 it's 1.4 mA.

I have previously successfully used the pm suspend to keep power low in sleep, but it seems it no longer works. I'm sure the fix is simple but I was unable to figure it out.

Here's the code:

main.c:

#include <zephyr/kernel.h>
#include <zephyr/pm/device.h>

static const struct device *uart = DEVICE_DT_GET(DT_NODELABEL(uart0));

int main(void) {
    pm_device_action_run(uart, PM_DEVICE_ACTION_SUSPEND);
    k_sleep(K_FOREVER);
    return 0;
}

prj.conf:

CONFIG_SENSOR=y
CONFIG_W1=y

CONFIG_LOG=n
CONFIG_SERIAL=n
CONFIG_CONSOLE=n
CONFIG_UART_CONSOLE=n

CONFIG_PM_DEVICE=y

promicro_nrf52840_nrf52840.overlay:

&uart0 {
	status = "okay";

	w1_0: w1-zephyr-serial-0 {
		compatible = "zephyr,w1-serial";
		#address-cells = <1>;
		#size-cells = <0>;
		status = "okay";

		ds18x20: ds18x20 {
			compatible = "maxim,ds18b20";
			family-code = <0x28>;
			resolution = <12>;
			status = "okay";
		};
	};
};

&pinctrl {
	uart0_default: uart0_default {
		group1 {
			psels = <NRF_PSEL(UART_RX, 1, 4)>;
			bias-pull-up;
		};
		group2 {
			psels = <NRF_PSEL(UART_TX, 1, 6)>;
			/* max. 5mA drive strength: */
			nordic,drive-mode = <NRF_DRIVE_H0D1>;
		};
	};

    uart0_sleep: uart0_sleep {
        group1 {
            psels = <NRF_PSEL(UART_TX, 1, 4)>,
                    <NRF_PSEL(UART_RX, 1, 6)>;
            low-power-enable;
        };
    };
};

Thank you in advance!

Best regards,

Sašo

Parents Reply Children
  • It seems that in the end Kentarou was able to reduce power consumption by suspending uart0, which is what I've been doing before the update and it doesn't work anymore. Given that this change was caused by a Zephyr update and is not directly nRF related, I will try to open an issue with them and see if someone can tell me what's to do in the new version. I will post the answer here if I get it.

Related