nRF52832 Central with FOTA

I have a Central using nRF52832. The project is working correctly but I’m having trouble getting FOTA via BLE to function on top of it.
I’m using NCS 3.0.2 (3.1.0 and higher seems to break the project so I’m not keen to upgrade just yet).
I’ve been unsuccessful in finding a working sample for Central with FOTA (compatible with NCS 3.0.2 and nRF52832). 
Specifically, I have a prj.conf containing:
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_GATT_DM=y
# This causes FOTA to fail...
CONFIG_BT_GATT_CLIENT=y
And sysbuild.conf with:
SB_CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_BT_GATT_CLIENT=y builds but causes FOTA to fail in application at bt_le_scan_start(...). With CONFIG_BT_GATT_CLIENT=n, the project won't build because it needs bt_gatt_read and by_gatt_discover!
Is there a Central with FOTA via BLE (SMP) sample that works with nRF52832 and NCS 3.0.2?
Thanks to anyone able to help!
Parents
  • Hello,

    I'm afraid we don't have any samples that exactly match your requirements. Do you want the device to also act as a peripheral so that mobile phones can discover connect to it and perform DFU while it is as a central and connected to another device? In that case, the /nrf/samples/bluetooth/central_and_peripheral_hr multirole sample may be useful as a reference.

    builds but causes FOTA to fail in application at bt_le_scan_start(...). With

    Did you get a crashlog from the device? To support both gap roles you must also set CONFIG_BT_MAX_CONN=2

    Best regards,

    Vidar

Reply
  • Hello,

    I'm afraid we don't have any samples that exactly match your requirements. Do you want the device to also act as a peripheral so that mobile phones can discover connect to it and perform DFU while it is as a central and connected to another device? In that case, the /nrf/samples/bluetooth/central_and_peripheral_hr multirole sample may be useful as a reference.

    builds but causes FOTA to fail in application at bt_le_scan_start(...). With

    Did you get a crashlog from the device? To support both gap roles you must also set CONFIG_BT_MAX_CONN=2

    Best regards,

    Vidar

Children
  • Hello Vidar.
    Thank you for your help.
    I got FOTA working by making the app boot into a peripheral role by button press at start-up. This enables FOTA with the settings shown below. If the button press doesn't happen at start-up, the app continues into its normal Central role.
    Best regards,
    Neill
    SB_CONFIG_BOOTLOADER_MCUBOOT=y (in sysbuild.conf)
    and in prj.conf:
    # Application,,,
    CONFIG_NFCT_PINS_AS_GPIOS=y
    CONFIG_GPIO=y

    # Enable MCUBoot
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

    # NVS (Non-Volatile Storage)
    CONFIG_FLASH=y
    CONFIG_FLASH_MAP=y
    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_RUNTIME=y
    CONFIG_NVS=y
    CONFIG_SETTINGS_NVS=y
    CONFIG_HEAP_MEM_POOL_SIZE=4096
    CONFIG_MPU_ALLOW_FLASH_WRITE=y
    # nRF52 usually needs this for writing internal flash

    CONFIG_NCS_SAMPLES_DEFAULTS=n

    CONFIG_BT_DEVICE_NAME="MyTest_FOTA"
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_GATT_DM=y
    CONFIG_BT_GATT_CLIENT=y
    CONFIG_BT_MAX_CONN=2

    # Enable the LBS service
    CONFIG_BT_LBS=n
    CONFIG_BT_LBS_POLL_BUTTON=n
    CONFIG_DK_LIBRARY=n

    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

    CONFIG_SIZE_OPTIMIZATIONS=y

    CONFIG_MAIN_STACK_SIZE=4096

    # Logging
    CONFIG_LOG=n

    CONFIG_CONSOLE=n
    CONFIG_USE_SEGGER_RTT=n
    CONFIG_RTT_CONSOLE=n
    CONFIG_LOG_BACKEND_RTT=n
  • Hello Neill,

    It sounds like you have come up with a good solution for this, thanks for the update. Since the primary purpose of the device is to operate in the GAP central role and the peripheral modee is only needed for DFU, it is probably good to be able avoid having the added complexity of managing multiple connections concurrently as in the multirole sample I mentioned earlier.

    Best regards,

    Vidar

Related