nrf52840 zephyr disable uart0 warning

It has been asked before but I couldn't find a satisfying answer so far. To reduce base power consumption of 600uA to roughly 3uA I disabled serial by setting CONFIG_SERIAL=n in prj.conf. But I get the following warning:

warning: UART_CONSOLE (defined at drivers/console/Kconfig:43) was assigned the value 'y' but got the
value 'n'. Check these unsatisfied dependencies: SERIAL (=n), SERIAL_HAS_DRIVER (=n). See
http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_UART_CONSOLE and/or look up UART_CONSOLE in
the menuconfig/guiconfig interface. The Application Development Primer, Setting Configuration
Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful too.

It does work however, and the powerconsumption is reduced. I'm on SDK v2.3.0.

I also tried to just disable serial in the device tree, but it's called somewhere in the project (probably <zephyr/logging/log.h>, so the build crashes unless I do the above.)

&pinctrl {
    uart0_default: uart0_default {
    		status="disabled";
    };
};

I also tried disabling using setting the powerstate at runtime, but I cannot figure the arguments I've to put in the function, as the signature has changed over time and I'm unable to find a current example. The latest I could find is of Zephyr 1.4.

int pm_device_state_set(conststructdevice*dev, uint32_t device_power_state,pm_device_cbcb,void*arg)

Question why is this warning and what is the right way to disable serial (or reduce power).

Edit: I guess it should be

err = pm_device_action_run(device, PM_DEVICE_ACTION_SUSPEND);

during runtime.

Parents
  • CONFIG_SERIAL=n in prj.conf. But I get the following warning:

    Use the "Kconfig" search in VS Code to determine what sets this to "y".
    Just looks like you set UART_CONSOLE in you project config somewhere, and it is automatically set to "n" when you disable SERIAL, which makes sense to me.

    I also tried to just disable serial in the device tree

    You try to disable uart0 inside pinctrl, and not inside the driver itself. Try:

    &uart0 {
        status = "disabled";
    };

    Then after you build, have a look at build/zephyr/zephyr.dts to verify that all the drivers have the expected status.

    Edit: I guess it should be

    Both DeviceTree and Power Management are good ways to disable a peripheral to save power.

    Use the DeviceTree if you never intend to use that peripheral.
    Use the Power Management if you intend to use the peripheral sporadically.

    Regards,
    Sigurd Hellesvik

Reply
  • CONFIG_SERIAL=n in prj.conf. But I get the following warning:

    Use the "Kconfig" search in VS Code to determine what sets this to "y".
    Just looks like you set UART_CONSOLE in you project config somewhere, and it is automatically set to "n" when you disable SERIAL, which makes sense to me.

    I also tried to just disable serial in the device tree

    You try to disable uart0 inside pinctrl, and not inside the driver itself. Try:

    &uart0 {
        status = "disabled";
    };

    Then after you build, have a look at build/zephyr/zephyr.dts to verify that all the drivers have the expected status.

    Edit: I guess it should be

    Both DeviceTree and Power Management are good ways to disable a peripheral to save power.

    Use the DeviceTree if you never intend to use that peripheral.
    Use the Power Management if you intend to use the peripheral sporadically.

    Regards,
    Sigurd Hellesvik

Children
Related