High PSM current during queue mode with LwM2M Client sample

Hello there,

I am currently testing queue mode within the LwM2M example with the nrf9160. Now I have made some measurements with the PPK2. Thereby I was surprised that the floor current, while the client should be in PSM, is very high with about 400 uA. Is this value realistic for this sample?

Previously I had measured 2.4uA with the UDP sample (which is very optimized, but still). So I think maybe there is some setting enabled that I overlooked that is drawing the current. How can I improve the power consumption in this regard? I have already tried to apply the settings from the UDP sample.

I am using SDK v2.0.2 and the nrf9160 (Rev2).

Many thanks,
Kurt Simon

  • Hi, I will try to run the LWM2M sample here, and check if I see the same thing. My first thought is that this is caused by one of the UARTs being enabled. You can try to turn it off by using CONFIG_SERIAL=n in the prj.conf file, but that only works if the sample itself doesn't use the UART actively (except for logging). I'm not so familiar with that sample so I can't tell you right now, but I will test and get back to you.

    Best regards,
    Stian

  • Hi, I tested the example here and I get around 600 uA because UART0 is active.

    Add this to the beginning of main() (after LOG_INF(APP_BANNER); ):

    const struct device *uart0_dev = device_get_binding(DT_LABEL(DT_CHOSEN(zephyr_console)));
    ret = pm_device_action_run(uart0_dev, PM_DEVICE_ACTION_SUSPEND);
    if (ret < 0) {
        LOG_ERR("Failed to disable UART (%d)", ret);
    }

    Include <pm/device.h> to main.c.

    Add CONFIG_PM_DEVICE=y to prj.conf

    This will turn off UART0. If you need to use UART0 you must look into implementing the Lower power UART driver and use flow control.

    Best regards,
    Stian

  • Hi Stian,

    thank you very much for your solution. I now get about 2 uA in the PSM, which is great.

    Best regards,

    Kurt Simon

  • Hi Stian

    We have pretty much the exact same situation, but on SDK Version 2.4.2.

    However, the solution code is deprecated and doesn't work anymore. Could you please post the current code or any other option for completely disabling UART in the LWM2M Client sample? Maybe it is possible with CONFIG options now?

    Your help would be greatly appreciated.

    Best regards,

    Alan

  • After some experimenting I have found code that works for me to deactivate UART in the first line of the main function.

    Maybe one of theses steps is redundant, but I set CONFIG_PM_DEVICE=y in an overlay

    and included

    #include <zephyr/pm/device.h>

    at the top of the main file.

    I did these two things to make the new code work in SDK Version 2.4.2

    The new code is:

    const struct device *uart0_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_shell_uart));
    ret = pm_device_action_run(uart0_dev, 0);
    if (ret < 0) {
        LOG_ERR("Failed to disable UART (%d)", ret);
    }

     You could probably write PM_DEVICE_ACTION_SUSPEND instead of 0 in the pm_device_action_run() function.

    Hope this helps someone in the future.

    I am now getting short periods (~1 second) of 7 uA in between some long periods of ~530 uA during downtime. So there is still something sucking a lot of electricity, but at least we can see the potential minimum draw when idle.

Related