Speed up start up after leaving system off

Hi

We use the nRF52832 for an NFC device. The device is 99.9 %  in the system off state to save power as much as possible. because the device is power by a button cell battery. The device has an e-paper and the display data are transfered over NFC. The user has the possible the change the displayed data with a external button.

uP = nRF52832
SDK = nRF Connect v2.6.1

In two case the device must wake up.
- User pushes the button
- Device receives new Data over NFC

At the moment the device is running well. But our customer wants the have the possibility to do a DFU over BLE. After adding the follwing modules to the "prj.conf" file the start up takes about 1 second, after leaving the system off mode. This is way to long. The usere wants to have a reaction from device after around 100ms when pushing the external button.

# Enable Bluetooth for FOTA (DFU)
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="TestDevice"
# Enable MCUboot and FOTA
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

Is there a way to shorten the start up time from system off mode?
Like enabling the moduls for FOTA (DFU) only when the useres wants to start the DFU mode while pushing a button and save the maximum power in deep sleep mode.

thanks and best regards
Markus

Parents
  • Hi Markus,

    I suspect that the main contributer to the increased startup time is from the bootloader validating the application image. You can disable that using CONFIG_BOOT_VALIDATE_SLOT0=n. If you do, the image will only be validated during DFU, but not for subsequent boots. Please note that this means that if for any reason the application region is corrupted or manipulated, the bootloader will boot it non the less, which you should be aware of from a security perspective.

  • Hi

    thanks for your Answer.

    CONFIG_BOOT_VALIDATE_SLOT0=n does not work. I got the compiler error, BOOT_VALIDATE_SLOT0 is undefined: What else do I have to add to the prj.conf file?

    #
    # Copyright (c) 2019 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    CONFIG_DK_LIBRARY=y
    
    #CONFIG_NFC_T2T_NRFXLIB=y  # NFC library only for read
    CONFIG_NFC_T4T_NRFXLIB=y   # NFC library for read and write
    
    CONFIG_NFC_NDEF=y
    CONFIG_NFC_NDEF_MSG=y
    CONFIG_NFC_NDEF_RECORD=y
    CONFIG_NFC_NDEF_TEXT_RECORD=y
    CONFIG_NFC_NDEF_URI_REC=y
    CONFIG_NFC_NDEF_URI_MSG=y
    
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    CONFIG_FLASH=y
    CONFIG_FLASH_PAGE_LAYOUT=y
    CONFIG_NVS=y
    
    CONFIG_SPI=y
    
    CONFIG_CRC=y
    CONFIG_APP_RETENTION=y  # used to keep data in RAM during stystem off
    
    #power save
    CONFIG_POWEROFF=y
    CONFIG_PM_DEVICE=y
    
    CONFIG_SERIAL=n
    CONFIG_CONSOLE=n
    CONFIG_UART_CONSOLE=n
    CONFIG_LOG=n 
    
    
    # Enable Bluetooth for FOTA (DFU)
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="Laufkarte"
    # Enable MCUboot and FOTA
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
    CONFIG_BOOT_VALIDATE_SLOT0=n
    
    # enable GPIO
    CONFIG_GPIO=y
    
    #save startup time
    CONFIG_BOOT_BANNER=n
    CONFIG_PRINTK=n
    CONFIG_DEBUG=n
    CONFIG_INIT_STACKS=n
    CONFIG_SHELL=n
    
    
    #set main thread priority
    CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

    thanks
    Markus

  • Hi Markus,

    CONFIG_BOOT_VALIDATE_SLOT0 is part of the MCUboot configuration. If you check the build folder for your project, you can refer to  see mcuboot/zephyr/.config and there I expect you will set CONFIG_BOOT_VALIDATE_SLOT0 is set to y, as that is the default. This shows the configs that are used for the project. You need to set it to n for mcuboot, so that could be either in the mcuboot prj.conf, or in an overlay file. The cleanest is probably to make a mcuboot.conf in a folder called sysbuild in your application folder, in the same way as here, and add the config there. After a re-build, you can check the .config I refered to to verify that it is being used.

  • Thanks.

    You are right in the build folder mcuboot/zephyr/.config is CONFIG_BOOT_VALIDATE_SLOT0 set to y.
    I added the suggestes mcboot.conf file to the sysbuild folder. Do I have to add the mcuboot.conf file to the build configuration? I yes where? I did add it to "Base configuration files" but then build still does not run without error

    c:/SwProjects/Laufkarte/trunk/Laufkarte/sysbuild/mcuboot.conf:1: warning: attempt to assign the value 'n' to the undefined symbol BOOT_VALIDATE_SLOT0
    
    error: Aborting due to Kconfig warnings
    
    CMake Error at C:/ncs/v2.6.1/zephyr/cmake/modules/kconfig.cmake:358 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      C:/ncs/v2.6.1/nrf/cmake/modules/kconfig.cmake:29 (include)
      C:/ncs/v2.6.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
      C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:9 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe '-Bc:\SwProjects\Laufkarte\trunk\Laufkarte\build_release' -GNinja -DBOARD=laufkarte_nrf52832 -DNCS_TOOLCHAIN_VERSION=NONE '-DCONF_FILE=c:/SwProjects/Laufkarte/trunk/Laufkarte/prj_release.conf;c:/SwProjects/Laufkarte/trunk/Laufkarte/sysbuild/mcuboot.conf' -DBOARD_ROOT=c:/swprojects/laufkarte/trunk/laufkarte '-Sc:\SwProjects\Laufkarte\trunk\Laufkarte'

  • Hi,

    If you add a mcuboot.conf in a folder called sysbuild directly in the project folder (where you have prj.conf and CMakeLists.txt etc), this will be picked up automatically. For instance, you can take the smp_svr sample and add a file called mcuboot.conf under sysbuild and add a line with CONFIG_BOOT_VALIDATE_SLOT0=n, and you will see that the generated .config no longer has CONFIG_BOOT_VALIDATE_SLOT0 set. I verified this approach on my end.

    If you can't make it work, can you share the project with your modification so that I can see?

Reply
  • Hi,

    If you add a mcuboot.conf in a folder called sysbuild directly in the project folder (where you have prj.conf and CMakeLists.txt etc), this will be picked up automatically. For instance, you can take the smp_svr sample and add a file called mcuboot.conf under sysbuild and add a line with CONFIG_BOOT_VALIDATE_SLOT0=n, and you will see that the generated .config no longer has CONFIG_BOOT_VALIDATE_SLOT0 set. I verified this approach on my end.

    If you can't make it work, can you share the project with your modification so that I can see?

Children
No Data
Related