UART Power Consumption with MODEM

Hi Nordic Team,

I am using the nRF52840 microcontroller and have interfaced a modem with one of its UART modules, as my modem communicates with the Nordic chip via UART. The issue I am facing is that even when I completely turn the modem OFF, the UART is still consuming approximately 150 to 200 µA. Specifically, the line CONFIG_SERIAL=y is causing this power consumption. If I disable this line in my proj.conf file, I encounter compilation errors because I am using UART drivers in my project.

Is there a solution to this problem so that the UART only consumes power when the modem is in use? Below are some configurations I am using in my project. Kindly be noted that I have only TX and RX lines of UART.



proj.conf file settings

CONFIG_SERIAL=y

# Power Management
CONFIG_PM=y
CONFIG_PM_DEVICE=y


.dts file settings

&uart1 {
     compatible = "nordic,nrf-uarte";
     status = "okay";
     current-speed = <115200>;
     pinctrl-0 = <&uart1_default>;
     pinctrl-1 = <&uart1_sleep>;
     pinctrl-names = "default", "sleep";

};

My modem UART Init function along with callback

// Get the modem device node labeled as uart1
const struct device *modem_dev = DEVICE_DT_GET(DT_NODELABEL(uart1));

int modem_init()
{
    int ret;

    // Init UART driver for Modem
    // printf("Initializing modem\n");

    if (!device_is_ready(modem_dev))
    {
        printf("UART1 is not ready!");
        return -1;
    }

    k_msleep(200);

    ret = uart_callback_set(modem_dev, modem_callback, NULL);
    if (ret != 0)
    {
        printf("Failed to set modem callback on UART1 (Error code: %d)\n", ret);
        return -2;
    }

    jsmn_init(&parser);

    // Check if the flash device was successfully obtained
    if (!device_is_ready(nrf_flash_dev))
    {
        printf("Nordic nRF5 flash driver was not found!\n");
        return -3;
    }
}

static void modem_callback(const struct device *dev, struct uart_event *evt, void *user_data)
{
    switch (evt->type)
    {
    case UART_RX_RDY:
        break;

    case UART_RX_DISABLED:
        // Re-enable UART RX to continuously receive responses
        // uart_rx_enable(dev, __modem_response_buffer, sizeof(__modem_response_buffer), NULL);
        break;

    case UART_RX_BUF_REQUEST:
        // Provide a new RX buffer for continuous reception
        uart_rx_buf_rsp(dev, __modem_response_buffer, sizeof(__modem_response_buffer));
        break;

    case UART_RX_STOPPED:
        break;

    case UART_RX_BUF_RELEASED:
        break;

    default:
        break;
    }
}




Related