This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thingy:91 Serial LTE modem PSM

I want to evaluate power consumption of nRF9160 used as AT command modem using Thingy:91 Serial LTE modem.

How to achieve lowest power consumption for Thingy:91 LTE Modem in PSM please ?

- Thingy:91 v1.0.0

- LTE modem app from ncs v1.4.0

- Modem firmware AT+CGMR mfw_nrf9160_1.2.2

https://www.joulescope.com/

- NB IoT Vodafone CZ, +CEREG: 5,"AE38","000AC51F",9,,,"00000000","00000111"

After AT#XSLEEP=0 or AT#XSLEEP=0 I am getting ~90uA average power consumption measured on P1 (SB3 cutted).

I am not able to wake up nRF9160 by UART communication or button.

Tested with following prj.conf build options for Serial LTE modem app:

- default

CONFIG_SLM_GPIO_WAKEUP = y

CONFIG_SLM_GPIO_WAKEUP = y & CONFIG_SLM_INTERFACE_PIN = 26

There is not CONFIG_SLM_CONNECT_UART_0 in prj.conf as stated in documentation https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.4.0/nrf/applications/serial_lte_modem/doc/slm_description.html

but there is CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - is it OK please ?

 

Whole default prj.conf from ncs v1.4.0:

# General config
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_STACK_SENTINEL=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_RING_BUFFER=y

# Segger RTT
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n

# Network
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n

# BSD library
CONFIG_BSD_LIBRARY=y
# Align the max FD entry to BSD_MAX_SOCKET_COUNT(8)
CONFIG_POSIX_MAX_FDS=8
# Enable below for modem trace
#CONFIG_BSD_LIBRARY_TRACE_ENABLED=y

# Use GPIO
CONFIG_GPIO=y
CONFIG_GPIO_NRFX=y
CONFIG_GPIO_NRF_P0=y

# UART interface
CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_TIMER2=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n

# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192

# AT_CMD
# Enable AT_CMD debug for details
#CONFIG_AT_CMD_LOG_LEVEL_DBG=y

# Device power management
CONFIG_DEVICE_POWER_MANAGEMENT=y

# Enable SUPL client support
#CONFIG_SUPL_CLIENT_LIB=y

# FOTA
CONFIG_HTTP_PARSER_URL=y
CONFIG_FOTA_DOWNLOAD=y
CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
CONFIG_DFU_TARGET=y
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# Application-specific
CONFIG_SLM_LOG_LEVEL_INF=y
# Enable GPIO wakeup if sleep is expected
#CONFIG_SLM_GPIO_WAKEUP=y
# Use UART_0 (when working with PC terminal)
CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
# Use UART_2 (when working with external MCU)
#CONFIG_SLM_CONNECT_UART_2=y
#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
# Use optional TCP/TLS Proxy
#CONFIG_SLM_TCP_PROXY=y
# Use optional UDP/DTLS Proxy
#CONFIG_SLM_UDP_PROXY=y
Parents
  • Hi, I tried this on a thingy91 and it works almost out of the box, with a couple of changes. I tried with the Serial LTE Modem application from NCS 1.4.0.

    You have to add CONFIG_SLM_GPIO_WAKEUP=y and CONFIG_SLM_INTERFACE_PIN=26 to the prj.conf as you did. No other changes are necessary to wake up using the button.

    Here is my full prj.conf:

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-BSD-5-Clause-Nordic
    #
    # General config
    CONFIG_LOG=y
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_STACK_SENTINEL=y
    CONFIG_NEWLIB_LIBC=y
    CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
    CONFIG_RING_BUFFER=y
    
    # Segger RTT
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_NATIVE=n
    
    # BSD library
    CONFIG_BSD_LIBRARY=y
    # Align the max FD entry to BSD_MAX_SOCKET_COUNT(8)
    CONFIG_POSIX_MAX_FDS=8
    # Enable below for modem trace
    #CONFIG_BSD_LIBRARY_TRACE_ENABLED=y
    
    # Use GPIO
    CONFIG_GPIO=y
    CONFIG_GPIO_NRFX=y
    CONFIG_GPIO_NRF_P0=y
    
    # UART interface
    CONFIG_SERIAL=y
    CONFIG_UART_ASYNC_API=y
    CONFIG_NRFX_TIMER2=y
    
    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
    
    # Stacks and heaps
    CONFIG_MAIN_STACK_SIZE=4096
    CONFIG_HEAP_MEM_POOL_SIZE=16384
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=8192
    
    # AT_CMD
    # Enable AT_CMD debug for details
    #CONFIG_AT_CMD_LOG_LEVEL_DBG=y
    
    # Device power management
    CONFIG_DEVICE_POWER_MANAGEMENT=y
    
    # Enable SUPL client support
    #CONFIG_SUPL_CLIENT_LIB=y
    
    # FOTA
    CONFIG_HTTP_PARSER_URL=y
    CONFIG_FOTA_DOWNLOAD=y
    CONFIG_FOTA_DOWNLOAD_PROGRESS_EVT=y
    CONFIG_DFU_TARGET=y
    CONFIG_DOWNLOAD_CLIENT=y
    CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_IMG_MANAGER=y
    CONFIG_FLASH=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    
    # Application-specific
    CONFIG_SLM_LOG_LEVEL_INF=y
    # Enable GPIO wakeup if sleep is expected
    CONFIG_SLM_GPIO_WAKEUP=y
    CONFIG_SLM_INTERFACE_PIN=26
    # Use UART_0 (when working with PC terminal)
    CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2
    # Use UART_2 (when working with external MCU)
    #CONFIG_SLM_CONNECT_UART_2=y
    #CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2
    # Use optional TCP/TLS Proxy
    #CONFIG_SLM_TCP_PROXY=y
    # Use optional UDP/DTLS Proxy
    #CONFIG_SLM_UDP_PROXY=y
    

    In order to reduce the idle current UART1 has to be disabled, since this is turned on by default in Zephyr. The easiest way to do this is to add an overlay file:

    Add the following to a file called thingy91_nrf9160ns.overlay (or thingy91_nrf9160.overlay if you are not building for non-secure) and save the file in the project root folder:

    &uart1 {
        status = "disabled";
    };

    You might have to delete the build folder for the new file to be found.

    Then, build for board thingy91_nrf9160ns (or thingy91_nrf9160), and flash the FW.

    Remember that the connectivity FW has to be flashed on the nRF52 in order to see the UART output over the USB connection.

    Push the button and you should see the terminal print "ready".

  • Hi, thank you for hints.

    I have CONFIG_SLM_GPIO_WAKEUP=y and CONFIG_SLM_INTERFACE_PIN=26 in prj.conf.

    In thingy91_nrf9160ns.overlay I have:

    &uart1 {
    status = "disabled";
    };

    &uart0 {
    /delete-property/ hw-flow-control;
    /delete-property/ rts-pin;
    /delete-property/ cts-pin;
    };

    I am able to wake up nRF9160 by GPIO.

    I am getting sometimes during nRF9160 wake up and always after closing serial port in nRF Connect LTE LInk Monitor those logs in nRF9160 RTT:

    [00:00:07.882,720] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.882,720] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.882,812] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.882,843] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.882,904] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.882,934] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.882,995] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.883,026] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.883,087] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.883,117] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.883,178] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.883,209] <wrn> at_host: RX_STOPPED (8)

    After that nRF9160 stops to communicate on serial port (do not react on AT). Serial port is reopened.

    In this state I have to power cycle nRF9160.
    How to fix that please ?

    I am using AT+CPSMS=1,,,"00100001","00000000" for PSM.

    After AT#XSLEEP=1 while in +CEREG: 5 and wakeup by GPIO (button on Thingy91) nRF9160 always re-register into EPC open new session and goes through +CEREG: 2.
    How to keep session during PSM please and save power for re-register please ?

Reply
  • Hi, thank you for hints.

    I have CONFIG_SLM_GPIO_WAKEUP=y and CONFIG_SLM_INTERFACE_PIN=26 in prj.conf.

    In thingy91_nrf9160ns.overlay I have:

    &uart1 {
    status = "disabled";
    };

    &uart0 {
    /delete-property/ hw-flow-control;
    /delete-property/ rts-pin;
    /delete-property/ cts-pin;
    };

    I am able to wake up nRF9160 by GPIO.

    I am getting sometimes during nRF9160 wake up and always after closing serial port in nRF Connect LTE LInk Monitor those logs in nRF9160 RTT:

    [00:00:07.882,720] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.882,720] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.882,812] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.882,843] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.882,904] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.882,934] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.882,995] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.883,026] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.883,087] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.883,117] <wrn> at_host: RX_STOPPED (8)
    [00:00:07.883,178] <wrn> at_host: RX_STOPPED (4)
    [00:00:07.883,209] <wrn> at_host: RX_STOPPED (8)

    After that nRF9160 stops to communicate on serial port (do not react on AT). Serial port is reopened.

    In this state I have to power cycle nRF9160.
    How to fix that please ?

    I am using AT+CPSMS=1,,,"00100001","00000000" for PSM.

    After AT#XSLEEP=1 while in +CEREG: 5 and wakeup by GPIO (button on Thingy91) nRF9160 always re-register into EPC open new session and goes through +CEREG: 2.
    How to keep session during PSM please and save power for re-register please ?

Children
  • Hi, I just tried waking up using a dummy byte over UART, and I managed to do it successfully while also keeping the connection.

    • First you have to set CONFIG_SLM_INTERFACE_PIN to 19, which is the uart0 RX on the thingy91.
    • Then in the exit_idle() function add a 1 second delay before slm_at_host_init(), so that the dummy byte finishes transmitting before the at host init. The function should now look like this:
      static void exit_idle(struct k_work *work)
      {
      	int err;
      
      	LOG_INF("Exit Idle");
      	gpio_pin_interrupt_configure(gpio_dev, CONFIG_SLM_INTERFACE_PIN,
      				     GPIO_INT_DISABLE);
      	gpio_remove_callback(gpio_dev, &gpio_cb);
      	/* Do the same as nrf_gpio_cfg_default() */
      	gpio_pin_configure(gpio_dev, CONFIG_SLM_INTERFACE_PIN, GPIO_INPUT);
      	/* Restart SLM services */
      	
      	k_sleep(K_MSEC(1000)); // <- ADD THIS LINE
      	
      	err = slm_at_host_init();
      	if (err) {
      		LOG_ERR("Failed to init at_host: %d", err);
      	}
      }

    Here are the AT commands I used in the LTE link Monitor:

    a
    Ready
    AT+CFUN=1
    OK
    AT+CEREG=5
    OK
    AT+CPSMS=1,"","","10100001","00000000"
    OK
    AT+CEREG?
    +CEREG: 5,5,"0AD3","020EC516",7,,,"00000000","00000110"
    OK
    AT#XSLEEP=0
    a
    Ready
    Ready
    AT+CEREG?
    +CEREG: 5,5,"0AD3","020EC516",7,,,"00000000","00000110"
    OK

    So you can see that I'm waking up with just sending the letter "a", then I get the Ready response, and then you see from the AT+CEREG? that the modem is still connected

    I also tried unplugging the USB after AT#XSLEEP=0, and plugging it back in, and it still works, still connected to the network (you have to reconnect to the USB device in the LTE Link Monitor software)

    NOTE

    I see that you are using AT#XSLEEP=1. This command is shutting down the modem, disconnecting from the network before going to sleep. Use AT#XSLEEP=0 if you want to keep the connection

Related