Trying to get the nRF5340 of the nRF7002 DK to low power

Dear All,

I am developing an application where I need to get the nRF5340 to the low power state, where the chip is consuming less than 10uA when it idle, while using the nRF7002 companion chip.

Starting with the simple blinky example, adding to the prj.conf

CONFIG_LOG=n
CONFIG_SERIAL=n


I am able to get the device to work with about 10uA on average.

The next step is to have a more complex project configuration that looks like this:

#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_WIFI=y
CONFIG_WIFI_NRF70=y

# # WPA supplicant
CONFIG_WIFI_READY_LIB=y

# # Networking
CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_POSIX_API=y
CONFIG_NET_LOG=y
CONFIG_NET_IPV4=y
CONFIG_NET_TCP=y
CONFIG_NET_DHCPV4=y

CONFIG_NET_PKT_RX_COUNT=16
CONFIG_NET_PKT_TX_COUNT=16
CONFIG_NRF70_RX_NUM_BUFS=16

# Below section is the primary contributor to SRAM and is currently
# tuned for performance, but this will be revisited in the future.
CONFIG_NET_BUF_RX_COUNT=16
CONFIG_NET_BUF_TX_COUNT=32
CONFIG_HEAP_MEM_POOL_SIZE=37000
CONFIG_HEAP_MEM_POOL_IGNORE_MIN=y
CONFIG_NRF_WIFI_CTRL_HEAP_SIZE=20000
CONFIG_NRF_WIFI_DATA_HEAP_SIZE=40000
CONFIG_NET_TC_TX_COUNT=1

CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=1
CONFIG_NET_MAX_CONTEXTS=6
CONFIG_NET_CONTEXT_SYNC_RECV=y

CONFIG_INIT_STACKS=y

CONFIG_NET_L2_ETHERNET=y

# Memories
CONFIG_MAIN_STACK_SIZE=5200
CONFIG_NET_TX_STACK_SIZE=4096
CONFIG_NET_RX_STACK_SIZE=4096

# # Logging
# # CONFIG_LOG=y
# # CONFIG_LOG_BUFFER_SIZE=2048

# TLS networking
CONFIG_NET_SOCKETS_TLS_MAX_CONTEXTS=3
CONFIG_NET_SOCKETS_SOCKOPT_TLS=y

# TLS credentials
CONFIG_TLS_CREDENTIALS=y
CONFIG_TLS_CREDENTIALS_BACKEND_PROTECTED_STORAGE=y

# mbedTLS
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_ENABLE_HEAP=y
CONFIG_MBEDTLS_HEAP_SIZE=101920
CONFIG_MBEDTLS_RSA_C=y
CONFIG_MBEDTLS_DHM_C=y
CONFIG_MBEDTLS_TLS_LIBRARY=y

# Optimize T-FM
CONFIG_TFM_PROFILE_TYPE_SMALL=y
CONFIG_PM_PARTITION_SIZE_TFM_SRAM=0xc000
CONFIG_PM_PARTITION_SIZE_TFM=0x20000

#Low power
CONFIG_LOG=n
CONFIG_SERIAL=n
# CONFIG_PINCTRL=y


When I am setting the CONFIG_SERIAL=n, I am getting the following error:
D:\zephyr-sdk-0.16.0\arm-zephyr-eabi\bin\arm-zephyr-eabi-gcc.exe -DKERNEL -DK_HEAP_MEM_POOL_SIZE=37000 -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF52_ERRATA_215_ENABLE_WORKAROUND=0 -DNRF5340_XXAA_APPLICATION -DNRF53_ERRATA_159_ENABLE_WORKAROUND=0 -DNRF53_ERRATA_43_ENABLE_WORKAROUND=0 -DNRF54L_CONFIGURATION_56_ENABLE=0 -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_LONG_LONG_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IC:/ncs/zephyr/modules/nrf_wifi/bus/inc -IC:/ncs/modules/lib/nrf_wifi/os_if/inc -ID:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated/zephyr -IC:/ncs/zephyr/include -ID:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated -IC:/ncs/zephyr/soc/nordic -IC:/ncs/zephyr/include/zephyr/posix -IC:/ncs/zephyr/soc/nordic/nrf53/. -IC:/ncs/zephyr/soc/nordic/common/. -IC:/ncs/zephyr/subsys/net/l2 -IC:/ncs/zephyr/drivers/wifi/nrf_wifi/inc -IC:/ncs/zephyr/subsys/net/ip -IC:/ncs/nrf/include -ID:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/tfm/api_ns/interface/include -ID:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/misc/generated -IC:/ncs/modules/lib/hostap/port/mbedtls -IC:/ncs/nrf/modules/trusted-firmware-m/. -IC:/ncs/nrf/include/tfm -IC:/ncs/nrf/tests/include -IC:/ncs/zephyr/modules/hostap/src -IC:/ncs/modules/lib/hostap -IC:/ncs/modules/lib/hostap/wpa_supplicant -IC:/ncs/modules/lib/hostap/src -IC:/ncs/modules/lib/hostap/src/common -IC:/ncs/modules/lib/hostap/src/eap_common -IC:/ncs/modules/lib/hostap/src/eap_server -IC:/ncs/modules/lib/hostap/src/radius -IC:/ncs/modules/lib/hostap/src/crypto -IC:/ncs/modules/lib/hostap/src/ap -IC:/ncs/modules/lib/hostap/src/drivers -IC:/ncs/modules/lib/hostap/src/rsn_supp -IC:/ncs/modules/hal/cmsis/CMSIS/Core/Include -IC:/ncs/modules/hal/cmsis_6/CMSIS/Core/Include -IC:/ncs/zephyr/modules/cmsis_6/. -IC:/ncs/nrf/modules/hal_nordic/. -IC:/ncs/modules/hal/nordic/nrfx -IC:/ncs/modules/hal/nordic/nrfx/drivers/include -IC:/ncs/modules/hal/nordic/nrfx/mdk -IC:/ncs/zephyr/modules/hal_nordic/nrfx/. -IC:/ncs/zephyr/modules/nrf_wifi/os -ID:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/certs -ID:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/generated/interface_nrf_security_psa -IC:/ncs/nrf/subsys/nrf_security/include -IC:/ncs/modules/crypto/oberon-psa-crypto/include -IC:/ncs/nrf/subsys/nrf_security/src/threading/include -IC:/ncs/nrf/subsys/nrf_security/src/utils -IC:/ncs/modules/crypto/oberon-psa-crypto/library -IC:/ncs/modules/crypto/mbedtls/library -IC:/ncs/modules/crypto/mbedtls/include -IC:/ncs/modules/crypto/mbedtls/include/library -IC:/ncs/nrfxlib/crypto/nrf_oberon/include -IC:/ncs/nrfxlib/crypto/nrf_oberon/include/mbedtls -isystem C:/ncs/zephyr/lib/libc/common/include -fno-strict-aliasing -Os -imacros D:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated/zephyr/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft --sysroot=D:/zephyr-sdk-0.16.0/arm-zephyr-eabi/arm-zephyr-eabi -imacros C:/ncs/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=D:/GIT_Projects/nRF7002DK_tcp_client=CMAKE_SOURCE_DIR -fmacro-prefix-map=C:/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=C:/ncs=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=picolibc.specs -D_POSIX_THREADS -std=c99 -MD -MT modules/nrf_wifi/bus/CMakeFiles/nrf70-buslib.dir/qspi_if.c.obj -MF modules\nrf_wifi\bus\CMakeFiles\nrf70-buslib.dir\qspi_if.c.obj.d -o modules/nrf_wifi/bus/CMakeFiles/nrf70-buslib.dir/qspi_if.c.obj -c C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c: In function '_qspi_device_uninit':
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:557:37: warning: implicit declaration of function 'QSPI_PROP_AT'; did you mean 'QSPI_PRESENT'? [-Wimplicit-function-declaration]
  557 |                 nrf_gpio_cfg_output(QSPI_PROP_AT(csn_pins, 0));
      |                                     ^~~~~~~~~~~~
      |                                     QSPI_PRESENT
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:557:50: error: 'csn_pins' undeclared (first use in this function)
  557 |                 nrf_gpio_cfg_output(QSPI_PROP_AT(csn_pins, 0));
      |                                                  ^~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:557:50: note: each undeclared identifier is reported only once for each function it appears in
In file included from C:/ncs/zephyr/include/zephyr/arch/arm/arch.h:20,
                 from C:/ncs/zephyr/include/zephyr/arch/cpu.h:19,
                 from C:/ncs/zephyr/include/zephyr/sys/cbprintf_internal.h:17,
                 from C:/ncs/zephyr/include/zephyr/sys/cbprintf.h:124,
                 from C:/ncs/zephyr/include/zephyr/logging/log_msg.h:11,
                 from C:/ncs/zephyr/include/zephyr/logging/log_core.h:9,
                 from C:/ncs/zephyr/include/zephyr/logging/log.h:11,
                 from C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:16:
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c: In function 'qspi_fill_init_struct':
D:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated/zephyr/devicetree_generated.h:16643:37: error: 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_sck_pin' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_status'?
16643 | #define DT_N_NODELABEL_qspi         DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5271:29: note: in definition of macro 'DT_CAT3'
 5271 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
      |                             ^~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:35:31: note: in expansion of macro 'DT_PROP'
   35 | #define QSPI_IF_BUS_SCK_PIN   DT_PROP(QSPI_IF_BUS_NODE, sck_pin)
      |                               ^~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5269:24: note: in expansion of macro 'DT_N_NODELABEL_qspi'
 5269 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
C:/ncs/zephyr/include/zephyr/devicetree.h:196:29: note: in expansion of macro 'DT_CAT'
  196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:30:26: note: in expansion of macro 'DT_NODELABEL'
   30 | #define QSPI_IF_BUS_NODE DT_NODELABEL(qspi)
      |                          ^~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:35:39: note: in expansion of macro 'QSPI_IF_BUS_NODE'
   35 | #define QSPI_IF_BUS_SCK_PIN   DT_PROP(QSPI_IF_BUS_NODE, sck_pin)
      |                                       ^~~~~~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:684:36: note: in expansion of macro 'QSPI_IF_BUS_SCK_PIN'
  684 |         initstruct->pins.sck_pin = QSPI_IF_BUS_SCK_PIN;
      |                                    ^~~~~~~~~~~~~~~~~~~
D:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated/zephyr/devicetree_generated.h:16643:37: error: 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_csn_pins' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_statu'?
16643 | #define DT_N_NODELABEL_qspi         DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5271:29: note: in definition of macro 'DT_CAT3'
 5271 | #define DT_CAT3(a1, a2, a3) a1 ## a2 ## a3
      |                             ^~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:36:31: note: in expansion of macro 'DT_PROP'
   36 | #define QSPI_IF_BUS_CSN_PIN   DT_PROP(QSPI_IF_BUS_NODE, csn_pins)
      |                               ^~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5269:24: note: in expansion of macro 'DT_N_NODELABEL_qspi'
 5269 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
C:/ncs/zephyr/include/zephyr/devicetree.h:196:29: note: in expansion of macro 'DT_CAT'
  196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:30:26: note: in expansion of macro 'DT_NODELABEL'
   30 | #define QSPI_IF_BUS_NODE DT_NODELABEL(qspi)
      |                          ^~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:36:39: note: in expansion of macro 'QSPI_IF_BUS_NODE'
   36 | #define QSPI_IF_BUS_CSN_PIN   DT_PROP(QSPI_IF_BUS_NODE, csn_pins)
      |                                       ^~~~~~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:685:36: note: in expansion of macro 'QSPI_IF_BUS_CSN_PIN'
  685 |         initstruct->pins.csn_pin = QSPI_IF_BUS_CSN_PIN;
      |                                    ^~~~~~~~~~~~~~~~~~~
D:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated/zephyr/devicetree_generated.h:16643:37: error: 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_io_pins_IDX_0' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_status_IDX_0'?
16643 | #define DT_N_NODELABEL_qspi         DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5275:37: note: in definition of macro 'DT_CAT5'
 5275 | #define DT_CAT5(a1, a2, a3, a4, a5) a1 ## a2 ## a3 ## a4 ## a5
      |                                     ^~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:37:31: note: in expansion of macro 'DT_PROP_BY_IDX'
   37 | #define QSPI_IF_BUS_IO0_PIN   DT_PROP_BY_IDX(QSPI_IF_BUS_NODE, io_pins, 0)
      |                               ^~~~~~~~~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5269:24: note: in expansion of macro 'DT_N_NODELABEL_qspi'
 5269 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
C:/ncs/zephyr/include/zephyr/devicetree.h:196:29: note: in expansion of macro 'DT_CAT'
  196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:30:26: note: in expansion of macro 'DT_NODELABEL'
   30 | #define QSPI_IF_BUS_NODE DT_NODELABEL(qspi)
      |                          ^~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:37:46: note: in expansion of macro 'QSPI_IF_BUS_NODE'
   37 | #define QSPI_IF_BUS_IO0_PIN   DT_PROP_BY_IDX(QSPI_IF_BUS_NODE, io_pins, 0)
      |                                              ^~~~~~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:686:36: note: in expansion of macro 'QSPI_IF_BUS_IO0_PIN'
  686 |         initstruct->pins.io0_pin = QSPI_IF_BUS_IO0_PIN;
      |                                    ^~~~~~~~~~~~~~~~~~~
D:/GIT_Projects/nRF7002DK_tcp_client/build/nRF7002DK_tcp_client/zephyr/include/generated/zephyr/devicetree_generated.h:16643:37: error: 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_io_pins_IDX_1' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000_P_reg_IDX_1'?
16643 | #define DT_N_NODELABEL_qspi         DT_N_S_soc_S_peripheral_40000000_S_qspi_2b000
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5275:37: note: in definition of macro 'DT_CAT5'
 5275 | #define DT_CAT5(a1, a2, a3, a4, a5) a1 ## a2 ## a3 ## a4 ## a5
      |                                     ^~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:38:31: note: in expansion of macro 'DT_PROP_BY_IDX'
   38 | #define QSPI_IF_BUS_IO1_PIN   DT_PROP_BY_IDX(QSPI_IF_BUS_NODE, io_pins, 1)
      |                               ^~~~~~~~~~~~~~
C:/ncs/zephyr/include/zephyr/devicetree.h:5269:24: note: in expansion of macro 'DT_N_NODELABEL_qspi'
 5269 | #define DT_CAT(a1, a2) a1 ## a2
      |                        ^~
C:/ncs/zephyr/include/zephyr/devicetree.h:196:29: note: in expansion of macro 'DT_CAT'
  196 | #define DT_NODELABEL(label) DT_CAT(DT_N_NODELABEL_, label)
      |                             ^~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:30:26: note: in expansion of macro 'DT_NODELABEL'
   30 | #define QSPI_IF_BUS_NODE DT_NODELABEL(qspi)
      |                          ^~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:38:46: note: in expansion of macro 'QSPI_IF_BUS_NODE'
   38 | #define QSPI_IF_BUS_IO1_PIN   DT_PROP_BY_IDX(QSPI_IF_BUS_NODE, io_pins, 1)
      |                                              ^~~~~~~~~~~~~~~~
C:/ncs/zephyr/modules/nrf_wifi/bus/qspi_if.c:687:36: note: in expansion of macro 'QSPI_IF_BUS_IO1_PIN'
  687 |         initstruct->pins.io1_pin = QSPI_IF_BUS_IO1_PIN;


Uncommenting the CONFIG_PINCTRL=y line at the end of my prj.conf allows for the project to build, but the current consumption while sleeping is quite high (~350uA):



My main looks like this:

int main(void)
{
    while (1) {
        k_sleep(K_FOREVER);
    }
}


I have tried the following Kconfigs as well, but without any changes:
CONFIG_TFM_LOG_LEVEL_SILENCE=y
CONFIG_NRF_WIFI_LOW_POWER=y
CONFIG_NRF70_QSPI_LOW_POWER=y


I have also tried allowing for serial in the prj.conf and powering it down in the code, setting the corresponding Kconfigs, but that also did not work.

I have also seen this article https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/optimizing-power-on-nrf53-designs
and tried to add the prj.conf in the sysbuild/ipc_radio described in step 1. This also did not made any difference.

I think that the issue that I am seeing is that the project is being built with the CONFIG_PINCTRL.

I am using nRF connect SDK v3.1.1.

Any ideas?

Thank you very much.

Parents Reply Children
No Data
Related