NRF5340: MCU Boot + SMP server callbacks

Hello, 

we use nrf5340 with Connect SDK v2.0.0 and we have adopted rules for indicating the update process and the operation of the bootloader in the device. Therefore, I would like to know:

  1. How can I understand that a connection to the server has occurred? Is it possible to assign a custom callback to SMP server running events?
  2. Similar question for bootloader. Is there a possibility (regular, without editing the sources) to obtain information about the process of transferring an image from one slot to another?
  3. To keep the device running, I need to generate a PWM signal (feature of the circuit). Accordingly, I need to start the PWM module before entering the MCU boot, but I didn't find a way to do it.   I know that it is possible to request a function call before the Zephyr kernel (SYS_INIT(pwmOutInit, PRE_KERNEL_2, 0);) starts, but this call again occurs after the MCU boot has started. Do I need to write my own power driver and replace the existing Zephyr? Or is it possible again to get access directly at the time of launching the MCU? 

Thanks

Parents
  • To get information about the progress of the update, just use the following code:

    struct img_mgmt_dfu_callbacks_t dfuCallbacks;
    
    dfuCallbacks.dfu_confirmed_cb = dfu_confirmed;
    dfuCallbacks.dfu_started_cb = dfu_started;
    dfuCallbacks.dfu_stopped_cb = dfu_stopped;
    dfuCallbacks.dfu_pending_cb = dfu_pending;
    
    img_mgmt_register_callbacks(&dfuCallbacks);

Reply
  • To get information about the progress of the update, just use the following code:

    struct img_mgmt_dfu_callbacks_t dfuCallbacks;
    
    dfuCallbacks.dfu_confirmed_cb = dfu_confirmed;
    dfuCallbacks.dfu_started_cb = dfu_started;
    dfuCallbacks.dfu_stopped_cb = dfu_stopped;
    dfuCallbacks.dfu_pending_cb = dfu_pending;
    
    img_mgmt_register_callbacks(&dfuCallbacks);

Children
  • What are the CONFIGs to add and header files to include?

  • I don’t remember everything that is needed for this, since the project is now a little abandoned. The project configuration contains the following:

    CONFIG_BT_SMP=y
    
    CONFIG_MCUBOOT_IMAGE_VERSION="1.1.10+0"
    
    CONFIG_MCUMGR=y
    CONFIG_MCUMGR_SMP_BT=y
    CONFIG_MCUMGR_SMP_BT_AUTHEN=n
    
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y
    
    # Enable custom SMP request to erase settings partition.
    CONFIG_MCUMGR_GRP_ZEPHYR_BASIC=y
    CONFIG_MCUMGR_GRP_BASIC_CMD_STORAGE_ERASE=y
    
    ################################################################################
    # Bootloader configuration
    
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_UPDATEABLE_IMAGE_NUMBER=1
    
    CONFIG_IMG_MANAGER=y
    CONFIG_MCUBOOT_IMG_MANAGER=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    CONFIG_BOOT_IMAGE_ACCESS_HOOKS=y

    I did this with an eye on the documentation provided by Nordic. and Google search, of course. and a couple of issues were resolved in the Zephyr discord server

    Good luck!

Related