OTA - Not working in Zephyr but works in SoftDevice

Hello,

I am using Celium device's BE33 (nRF52833 based) Click here for datasheet. there are crystal pins exposed in this controller but I dont want to use external crystal so I have added below to prj.conf

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y

I am trying to implement https://getwavecake.com/blog/adding-ota-dfu-to-a-nordic-zephyr-project/ This example which is a reference of Nordic/Zephyr/samples/bluetooth/peripheral_hr example.

Here I am facing a boot problem. Once I set CONFIG_BOOTLOADER_MCUBOOT=y this problem begins. I need to touch to the crystal pins once to get started otherwise it won't start on its own. But when I am using softdevice DFU example it works well without the need to touch the crystal pins. why so ? Am I doing anything wrong?

Thanks in advance.

Regards,

Neeraj Dhekale

Parents Reply Children
  • Not sure what is wrong. 

    Try to delete the build configuration and create it again. 

    -Amanda H.

  • Hello Amanda,

    Sorry for the delay in response.

    I have create folder named "child_image" in peripheral_hr project.

    in child_image folder I have created new folder named mcuboot and created prj.conf file in it.

    in peripheral_hr/prj.conf file I have added below line:

    CONFIG_BOOTLOADER_MCUBOOT=y

    added content of /child_image/mcuboot/prj.conf file:

    # Enable mcumgr.
    CONFIG_MCUMGR=y
    
    # Some command handlers require a large stack.
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    
    # Ensure an MCUboot-compatible binary is generated.
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # Enable flash operations.
    CONFIG_FLASH=y
    
    # Required by the `taskstat` command.
    CONFIG_THREAD_MONITOR=y
    
    # Enable statistics and statistic names.
    CONFIG_STATS=y
    CONFIG_STATS_NAMES=y
    
    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    CONFIG_MCUMGR_CMD_STAT_MGMT=y
    
    # Allow for large Bluetooth data packets.
    CONFIG_BT_L2CAP_TX_MTU=252
    CONFIG_BT_BUF_ACL_RX_SIZE=256
    
    # Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
    CONFIG_MCUMGR_SMP_BT=y
    CONFIG_MCUMGR_SMP_BT_AUTHEN=n
    CONFIG_MCUMGR_SMP_SHELL=y
    CONFIG_CHILDAPP_BUILD_STRATEGY_FROM_SOURCE=y

    Next, I copied the boot folder and other content of mcuboot folder from mcuboot github.

    in peripheral_hr folder I have added below lines in CMakeLists.txt file:

    if (CONFIG_BOOTLOADER_MCUBOOT)
       add_child_image(
         NAME mcuboot
         SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/child_image/mcuboot/zephyr
         )
    endif()

    After the build I am getting the below error:

    *  Executing task: nRF Connect: Generate config nrf52833dk_nrf52833 for /home/neeraj/Applications/Nordic/peripheral_hr

    Building peripheral_hr
    /bin/sh -c west build --build-dir /home/neeraj/Applications/Nordic/peripheral_hr/build /home/neeraj/Applications/Nordic/peripheral_hr --pristine --board nrf52833dk_nrf52833 -- -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DBOARD_ROOT:STRING="/home/neeraj/Applications/Nordic/peripheral_hr"

    -- west build: generating a build system
    Including boilerplate (Zephyr base): /home/neeraj/Applications/Nordic/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/neeraj/Applications/Nordic/peripheral_hr
    -- Zephyr version: 2.7.0 (/home/neeraj/Applications/Nordic/zephyr), build: v2.7.0-ncs1
    -- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.12") found components: Interpreter
    -- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
    -- Board: nrf52833dk_nrf52833
    -- Cache files will be written to: /home/neeraj/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/neeraj/gnuarmemb)
    -- Found BOARD.dts: /home/neeraj/Applications/Nordic/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833.dts
    -- Found devicetree overlay: /home/neeraj/Applications/Nordic/peripheral_hr/nrf52833dk_nrf52833.overlay
    -- Generated zephyr.dts: /home/neeraj/Applications/Nordic/peripheral_hr/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/neeraj/Applications/Nordic/peripheral_hr/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/neeraj/Applications/Nordic/peripheral_hr/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/neeraj/Applications/Nordic/peripheral_hr/build/zephyr/dts.cmake

    warning: BT_CTLR_ADVANCED_FEATURES (defined at subsys/bluetooth/controller/Kconfig.ll_sw_split:114)
    was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies:
    BT_LL_SW_SPLIT (=n). See
    docs.zephyrproject.org/.../CONFIG_BT_CTLR_ADVANCED_FEATURES.html and/or
    look up BT_CTLR_ADVANCED_FEATURES in the menuconfig/guiconfig interface. The Application Development
    Primer, Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual
    might be helpful too.


    warning: The choice symbol WDT_LOG_LEVEL_DBG (defined at
    subsys/logging/Kconfig.template.log_config:20) was selected (set =y), but no symbol ended up as the
    choice selection. See
    docs.zephyrproject.org/.../CONFIG_WDT_LOG_LEVEL_DBG.html and/or look up
    WDT_LOG_LEVEL_DBG in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.

    Parsing /home/neeraj/Applications/Nordic/zephyr/Kconfig
    Loaded configuration '/home/neeraj/Applications/Nordic/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833_defconfig'
    Merged configuration '/home/neeraj/Applications/Nordic/peripheral_hr/prj.conf'
    Configuration saved to '/home/neeraj/Applications/Nordic/peripheral_hr/build/zephyr/.config'
    Kconfig header saved to '/home/neeraj/Applications/Nordic/peripheral_hr/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 10.3.1
    -- The CXX compiler identification is GNU 10.3.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /home/neeraj/gnuarmemb/bin/arm-none-eabi-gcc

    === child image mcuboot -  begin ===
    Including boilerplate (Zephyr base): /home/neeraj/Applications/Nordic/zephyr/cmake/app/boilerplate.cmake
    -- Application: /home/neeraj/Applications/Nordic/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.7.0 (/home/neeraj/Applications/Nordic/zephyr), build: v2.7.0-ncs1
    -- Found Python3: /usr/bin/python3.10 (found suitable exact version "3.10.12") found components: Interpreter
    -- Found west (found suitable version "0.13.1", minimum required is "0.7.1")
    -- Board: nrf52833dk_nrf52833
    -- Cache files will be written to: /home/neeraj/.cache/zephyr
    -- Found dtc: /usr/bin/dtc (found suitable version "1.6.1", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/home/neeraj/gnuarmemb)
    -- Found BOARD.dts: /home/neeraj/Applications/Nordic/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833.dts
    -- Found devicetree overlay: /home/neeraj/Applications/Nordic/nrf/modules/mcuboot/usb.overlay
    -- Found devicetree overlay: /home/neeraj/Applications/Nordic/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: /home/neeraj/Applications/Nordic/peripheral_hr/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /home/neeraj/Applications/Nordic/peripheral_hr/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: /home/neeraj/Applications/Nordic/peripheral_hr/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: /home/neeraj/Applications/Nordic/peripheral_hr/build/mcuboot/zephyr/dts.cmake

    warning: BOOTLOADER_MCUBOOT (defined at Kconfig.zephyr:561) was assigned the value 'y' but got the
    value 'n'. Check these unsatisfied dependencies: (!MCUBOOT) (=n). See
    docs.zephyrproject.org/.../CONFIG_BOOTLOADER_MCUBOOT.html and/or look up
    BOOTLOADER_MCUBOOT in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.


    /home/neeraj/Applications/Nordic/peripheral_hr/child_image/mcuboot/prj.conf:33: warning: attempt to assign the value 'y' to the undefined symbol CHILDAPP_BUILD_STRATEGY_FROM_SOURCE

    error: Aborting due to Kconfig warnings

    Parsing /home/neeraj/Applications/Nordic/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration '/home/neeraj/Applications/Nordic/zephyr/boards/arm/nrf52833dk_nrf52833/nrf52833dk_nrf52833_defconfig'
    Merged configuration '/home/neeraj/Applications/Nordic/peripheral_hr/child_image/mcuboot/prj.conf'
    Merged configuration '/home/neeraj/Applications/Nordic/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    CMake Error at /home/neeraj/Applications/Nordic/zephyr/cmake/kconfig.cmake:270 (message):
      command failed with return code: 1
    Call Stack (most recent call first):
      /home/neeraj/Applications/Nordic/zephyr/cmake/app/boilerplate.cmake:546 (include)
      /home/neeraj/Applications/Nordic/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:24 (include)
      /home/neeraj/Applications/Nordic/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:35 (include_boilerplate)
      CMakeLists.txt:44 (find_package)


    -- Configuring incomplete, errors occurred!
    CMake Error at /home/neeraj/Applications/Nordic/nrf/cmake/multi_image.cmake:306 (message):
      CMake generation for mcuboot failed, aborting.  Command: 1
    Call Stack (most recent call first):
      /home/neeraj/Applications/Nordic/nrf/cmake/multi_image.cmake:68 (add_child_image_from_source)
      /home/neeraj/Applications/Nordic/nrf/modules/mcuboot/CMakeLists.txt:216 (add_child_image)


    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: /usr/bin/cmake -DWEST_PYTHON=/usr/bin/python3 -B/home/neeraj/Applications/Nordic/peripheral_hr/build -S/home/neeraj/Applications/Nordic/peripheral_hr -GNinja -DBOARD=nrf52833dk_nrf52833 -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DBOARD_ROOT:STRING=/home/neeraj/Applications/Nordic/peripheral_hr

     *  The terminal process terminated with exit code: 1.
     *  Terminal will be reused by tasks, press any key to close it.

  • Hi Amanda,

    I need to touch to the crystal pins once to get started otherwise it won't start on its own. But when I am using softdevice DFU example it works well without the need to touch the crystal pins

    I have followed all the steps the same way you have suggested  in the above link... I am able to build and flash successful.. but the above problem persist as I have mentioned in my 1st main thread.

    Why do I need to toch to crystal pins to make it start. once it is is started I don't need to touch and DFU works very well.

    Now I can see mcuboot under build. This means child_image has been considered to it. I hope so.

    Am I doing anything wrong?

    Thanks and regards,

    Neeraj Dhekale

  • Hi, 

    Try to add CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y and CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y in the child_image/mcuboot/prj.conf.

    -Amanda H.

Related