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

nRF9160 current consumption

Hi,

I use nRF9160 custom board and my application uses USART, ADC, I2c, SPI, RTC and LTE modem.
Currently I am trying to reduce sleep current on IDLE state which is 850 uA.


I noticed that the drivers pm functions were not invoked.

Can anybody give me advice to decrease the current consumption?

Thank's

Meni

prj.conf

# General config
CONFIG_ASSERT=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_THREAD_NAME=y
CONFIG_NEWLIB_LIBC=y
CONFIG_REBOOT=y
#CONFIG_SEGGER_SYSTEMVIEW=y
#CONFIG_TRACING=y
CONFIG_THREAD_MONITOR=y
#CONFIG_NUM_PREEMPT_PRIORITOES=6
#CONFIG_NUM_COOP_PRIORITOES=0


# MCUBOOT
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y
CONFIG_MCUBOOT_IMG_MANAGER=y

# Flash & #NVS
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
#CONFIG_FLASH_LOG_LEVEL_DBG=y
#CONFIG_FLASH_LOG_LEVEL=4
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y


# log rtt
CONFIG_UART_CONSOLE=y
CONFIG_RTT_CONSOLE=n
#CONFIG_HAS_SEGGER_RTT=n
CONFIG_USE_SEGGER_RTT=n
 
# LOG new
CONFIG_LOG=y
#CONFIG_LOG_IMMEDIATE=y
CONFIG_LOG_PRINTK=y
#CONFIG_LOG_BUFFER_SIZE=2048
#CONFIG_AT_CMD_LOG_LEVEL_DBG=y
#CONFIG_LTE_LINK_CONTROL_LOG_LEVEL_DBG=y
#CONFIG_LTE_LINK_CONTROL_LOG_LEVEL=4


# Network
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_OFFLOAD=y

# LTE link control
#Turn on to make the LTE Link Controller to automatically initialize and connect the modem before the application starts0
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_PSM_REQ_RPTAU="00000110"
CONFIG_LTE_PSM_REQ_RAT="00000000"

# TCP
CONFIG_NET_BUF_USER_DATA_SIZE=1
CONFIG_NET_SOCKETS_POSIX_NAMES=y
#CONFIG_NET_RAW_MODE=y

# BSD library
CONFIG_BSD_LIBRARY=y

# AT host library
CONFIG_AT_HOST_LIBRARY=y
CONFIG_UART_INTERRUPT_DRIVEN=y
#CONFIG_AT_HOST_UART=2


# Stacks and heaps
CONFIG_MAIN_STACK_SIZE=8192
#CONFIG_HEAP_MEM_POOL_SIZE=71680
CONFIG_HEAP_MEM_POOL_SIZE=65536
CONFIG_HW_STACK_PROTECTION=y


# Disable native network stack to save some memory
#CONFIG_NET_IPV4=n
CONFIG_NET_IPV6=n
CONFIG_NET_UDP=n
#CONFIG_NET_TCP=n

# ADC
CONFIG_ADC=y
CONFIG_ADC_0=y
CONFIG_ADC_NRFX_SAADC=y

CONFIG_KERNEL_LOG_LEVEL_DBG=y
CONFIG_SYS_PM_LOG_LEVEL_DBG=y
#CONFIG_TRACING=y

CONFIG_TICKLESS_IDLE=y
CONFIG_TICKLESS_IDLE_THRESH=3
CONFIG_TICKLESS_KERNEL=y
CONFIG_SYS_POWER_MANAGEMENT=y
CONFIG_SYS_POWER_SLEEP_STATES=y
CONFIG_DEVICE_POWER_MANAGEMENT=y
CONFIG_DEVICE_IDLE_PM=y

#UART
CONFIG_SERIAL=y
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_2_NRF_UARTE=y
CONFIG_UART_2_NRF_TX_BUFFER_SIZE=255
#CONFIG_UARTE_NRF_LOG_LEVEL_DBG=y
#CONFIG_UARTE_NRF_LOG_LEVEL=4
#CONFIG_DMA_LOG_LEVEL=4
#CONFIG_DMA_LOG_LEVEL_DBG=y

#SPI
CONFIG_SPI=y
CONFIG_SPI_3=y
CONFIG_SPI_3_NRF_SPIM=y
CONFIG_SPI_3=y 
CONFIG_SPI_NRFX=y
CONFIG_MAIN_STACK_SIZE=4096
#CONFIG_SPI_NRFX_SPIM_MISO_NO_PULL is not set
#CONFIG_SPI_NRFX_SPIM_MISO_PULL_DOWN is not set
#CONFIG_SPI_NRFX_SPIM_MISO_PULL_UP=y

#CONFIG_SPI_LOG_LEVEL_DBG=y
#CONFIG_SPI_LOG_LEVEL=4



# Enable I2C
CONFIG_I2C=y
CONFIG_I2C_NRFX=y
CONFIG_I2C_1=y
CONFIG_I2C_2=n
CONFIG_I2C_INIT_PRIORITY=60

CONFIG_COMPILER_OPT="-DNRFX_RTC_ENABLED=1 -DNRFX_RTC0_ENABLED=1"

CONFIG_DEBUG_OPTIMIZATIONS=y

  • The simplest way to reduce the current is to disable the unused peripherals that are not necessary when in IDLE.

    What systems are incapable of being used in IDLE should be disabled during runtime using code such as:

    printk("Disabling SPI\n");
    
    NRF_SPIM3_NS->TASKS_STOP = 1;
    NRF_SPIM3_NS->ENABLE = 0;

    Refer to the user manual on peripherasl to see how to do this with the other ones. Be sure to write code that can re-enable them as well as disable.

    For other systems, consider smarter ways to incorperate them. Such as; when IDLE, disable all peripherals and enter low power IDLE. If interrupt pin triggers, re-enable only the perpiherals required to deal with that interupt.

    UART0, serial port should be disabled if it is not being used for debugging to further reduce the power consumption, (this usually drains several hundred uAs).

  • Are  there any hooks functions that invoke while the device enters and exits from sleep mode?

  • I'm not sure what you mean? How exactly are you 'sleeping' the device?

    The module can go very low (I've measured 7uA on the Development Kit) in a low power IDLE state. However, it is your own code that is managing the application, including the IDLE state. I'm not sure why you would need hook functions.

    Your custon FW manages how the device transitions different states, so you wouldn't hook anything. Just invoke some additonal features in your state transitions to disable/enable some peripherals.

  • According to the following link:
    docs.zephyrproject.org/.../index.html

    When the device becomes idle for at least CONFIG_TICKLESS_IDLE_THRESH ticks, the OS context switch should be disabled.
    In this state, I want to disable UART0 debugging port etc'.

    There for I turned on the flags:
    CONFIG_TICKLESS_IDLE=y
    CONFIG_TICKLESS_IDLE_THRESH=3
    CONFIG_SYS_POWER_SLEEP_STATES=y

    In that case the user API's:

    void sys_pm_notify_power_state_entry(enum power_states state)
    void sys_pm_notify_power_state_exit(enum power_states state)

    should be called by the OS, but for some reason it does not happen.


    In any case, even when I disable all peripherals (including UART0) i am getting 200uA
    And I can't find the reason for that.

  • Ok, I think I need more information about your application.

    Is your main() function looping or can your application fall straight through and work off of work queues and other threads?

    If it doesn't then this won't work. This assumes that there are no threads that are ready to run including the main thread and therefore the kernal scheduler is IDLE.

    Your application being IDLE and the kernal scheduler being IDLE are two very different things.

    For the power consumption, have you any figures for how much current drain your device makes from other parts of the device. There could be consumption from other things on your device. Also, to get lower consumption then you need to disable more than just UART0.

Related