How to disable UART20 runtime for low power

Dear support,

We need to disable the UART20 runtime. Currently it is configured as follows:

CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_20_INTERRUPT_DRIVEN=n
CONFIG_UART_20_ASYNC=y
I need to disable permanently this UART runtime from the application, i.e., 1 minute after boot.
Can you help me disable the UART safely with a snippet of code for low power consumption? 
thank you
marco
  • Hello,

    Conceptually (not tested) it should be done like below:

    Zephyr provides a power management API to suspend and resume devices, including UART.

    Suspend UART

    #include <zephyr/pm/device.h>

    const struct device *uart_dev = DEVICE_DT_GET(DT_NODELABEL(uart0)); // or uart1, etc.

    if (device_is_ready(uart_dev)) {
    pm_device_action_run(uart_dev, PM_DEVICE_ACTION_SUSPEND);
    }

    Resume UART

    if (device_is_ready(uart_dev)) {
    pm_device_action_run(uart_dev, PM_DEVICE_ACTION_RESUME);
    }

    In your prj.conf:
    CONFIG_PM=y
    CONFIG_PM_DEVICE=y

    Hope that helps,
    Kenneth

Related