"Error: sending the request failed" trying to perform OTA DFU with nRF Connect app

I am on nRF Connect 2.5.0 SDK. I am trying to add OTA DFU support to my custom board using the MCUBoot bootloader, and everything appears normal when I look at the characteristic table but when trying to upload to the device using the nRF Connect app on iOS, the app appears to slowly upload the firmware (displaying low upload speed ~0.5kbps) then after a few minutes gives me "Error: sending the request failed". My board has no UART connection and I have been using RTT logging using the J-link on an nrf52DK; from what I have seen MCUboot logging with RTT is not reliable, and I have not been able to get it to work either. 

My procedure: 

1. Build and flash MCUboot and app onto the custom board with an nrf52DK.

2. Change my app and build the new app.

3. use nRF Connect app to try to upload 'app_update.bin' to device in upgrade mode "test and confirm". The procedure always fails before completing.

Here is my bootlaoder config in my prj.conf:

 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Bootloader Configuration
#==================================
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y
CONFIG_MCUBOOT_BOOTLOADER_MODE_SWAP_WITHOUT_SCRATCH=y
CONFIG_MCUBOOT_BOOTLOADER_NO_DOWNGRADE=n
CONFIG_IMG_MANAGER=y
CONFIG_PARTITION_MANAGER_ENABLED=y
# Enable most core commands.
CONFIG_MCUMGR_GRP_IMG=y
CONFIG_MCUMGR_GRP_OS=y
# Enable mcumgr.
CONFIG_MCUMGR=y
CONFIG_MCUMGR_TRANSPORT_BT=y
CONFIG_MCUMGR_TRANSPORT_BT_AUTHEN=n
# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=3072
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Here is my child_image/mcuboot.conf: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y
#this is an absolute path, change it yourself
CONFIG_BOOT_SIGNATURE_KEY_FILE="C:/Vitalmark/keys/private.pem"
#reduce mcuboot partition size
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
# Disable UART Console and enable the RTT console
CONFIG_UART_CONSOLE=n
CONFIG_RTT_CONSOLE=y
CONFIG_USE_SEGGER_RTT=y
# Config logger
CONFIG_LOG_BACKEND_RTT=y
CONFIG_LOG_BACKEND_UART=n
CONFIG_MULTITHREADING=y
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

and I have also statically defined the flash partitions in pm_static.yml based on the first automatically partitioned build:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
app:
address: 0x10200
end_address: 0x48000
region: flash_primary
size: 0x37e00
mcuboot:
address: 0x0
end_address: 0x10000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0x10000
mcuboot_pad:
address: 0x10000
end_address: 0x10200
placement:
align:
start: 0x1000
before:
- mcuboot_primary_app
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Here is the log from the nrf connect app: 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Scanner On.
Device Scanned.
Device Appearance switched from Generic to UART.
Connected.
Discovered Nordic UART Service, 0483DADD-6C9D-6CA9-5D41-03AD4FFF4ABB, and SMP Service Services.
Discovered Characteristics UART TX Characteristic and UART RX Characteristic for Service Nordic UART Service.
Discovered Characteristics 1524 for Service 0483DADD-6C9D-6CA9-5D41-03AD4FFF4ABB.
Discovered Characteristics SMP Characteristic for Service SMP Service.
Discovered Client Characteristic Configuration for Characteristic UART TX Characteristic
Characteristic UART RX Characteristic has no Descriptors.
Characteristic 1524 has no Descriptors.
Device Appearance switched from UART to McuMgrDFU.
Discovered Client Characteristic Configuration for Characteristic SMP Characteristic
Found valid Firmware in file:///var/mobile/Containers/Data/Application/4D4197EB-C6BC-4ECA-861F-10957E6527CB/Library/Caches/app_updateAF08E5E7-D04E-4537-986B-CAA02FF5CA2D-95620-00001C3F1CF8B74E.bin for Device DFU McuMgr.
Central Manager ready
Peripheral connected
Device ready
LIST Command Performed with Success.
Upgrade started with 1 image(s) using 'Test and Confirm' mode
Firmware Upgrade Started.
State changed from none to requestMcuMgrParameters
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

I am fairly certain it is not a connection issue, since I never had any issues with the old NordicDFU on the nrf5 SDK using the exact same board. Since I don't have a UART port for MCUBoot logging I'm not sure how I can diagnose this issue. Any help would be much appreciated

Parents Reply
  • I tested my app on the nRF52DK, it is also slow (0.11kB/s). I realized that I had 

    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n, and I changed it to 
    CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=y. After this I saw with the sniffer that the app negotiated MTU=498, but the update is just as slow nrf_device_manager_dfu3.pcapng. I don't think that the link is the bottleneck here. I currently have nothing in my main app to handle the DFU. Is there anything I can do in my app, like detecting when the firmware update is happening and turning off other threads/functions?
    Tony
Children
  • Could you test the Peripheral LBS by enabling CONFIG_BOOTLOADER_MCUBOOT=y and CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y?

    Do you see the upload speed different? If so, you could compare the .config under build/zephyr. If not, please upload your project. 

    -Amanda H.

  • When I test the Peripheral LBS, I get much faster upload speed, around 5.5kbps. Here is build/zephyr/config for my project: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    # CONFIG_INPUT is not set
    # CONFIG_WIFI is not set
    # CONFIG_LV_COLOR_16_SWAP is not set
    CONFIG_LV_DPI_DEF=130
    # CONFIG_MIPI_DSI is not set
    # CONFIG_MODEM is not set
    CONFIG_SPI=y
    # CONFIG_BT_HCI_ACL_FLOW_CONTROL is not set
    # CONFIG_BT_HCI_VS_EXT is not set
    CONFIG_BOARD="vitalmark_nrf52832_board"
    CONFIG_BT_CTLR=y
    CONFIG_NUM_IRQS=39
    CONFIG_SOC_SERIES="nrf52"
    CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32768
    CONFIG_SOC="nRF52832_QFAA"
    CONFIG_CLOCK_CONTROL_INIT_PRIORITY=30
    CONFIG_FLASH_SIZE=512
    CONFIG_FLASH_BASE_ADDRESS=0x0
    CONFIG_ICACHE_LINE_SIZE=32
    CONFIG_DCACHE_LINE_SIZE=32
    CONFIG_HEAP_MEM_POOL_SIZE=256
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    and here is build/zephyr/config for the Peripheral LBS sample.
    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    # CONFIG_INPUT is not set
    # CONFIG_WIFI is not set
    # CONFIG_LV_COLOR_16_SWAP is not set
    CONFIG_LV_DPI_DEF=130
    # CONFIG_MIPI_DSI is not set
    # CONFIG_MODEM is not set
    # CONFIG_UART_INTERRUPT_DRIVEN is not set
    # CONFIG_SPI is not set
    # CONFIG_BT_HCI_ACL_FLOW_CONTROL is not set
    CONFIG_BT_HCI_VS_EXT=y
    CONFIG_BOARD="test_nrf52_board"
    CONFIG_BT_CTLR=y
    CONFIG_NUM_IRQS=39
    CONFIG_SOC_SERIES="nrf52"
    CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=32768
    CONFIG_SOC="nRF52832_QFAA"
    CONFIG_CLOCK_CONTROL_INIT_PRIORITY=30
    CONFIG_FLASH_SIZE=512
    CONFIG_FLASH_BASE_ADDRESS=0x0
    CONFIG_ICACHE_LINE_SIZE=32
    CONFIG_DCACHE_LINE_SIZE=32
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    I haven't been able to find any major differences other than the logging settings when I look at them side by side, but I'm not exactly sure what I should be looking for. Is there a chance that it has anything to do with my code itself?

    Thanks for all your help so far.

  • Hi, 

    I don't think of anything that needs to be handled in the application. You can take a look at my colleagues' sample https://github.com/hellesvik-nordic/samples_for_nrf_connect_sdk/tree/main/bootloader_samples/smp/mcuboot_smp_ble 

    Maybe you can compare the .config under build/mcuboot/zephyr to get the clues. Could you also provide the .config under build/mcuboot/zephyr?

    -Amanda H. 

  • Here is build/mcuboot/zephyr/.config for my app: 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #
    # MCUboot-specific configuration options
    #
    # CONFIG_BOOT_USE_MIN_PARTITION_SIZE is not set
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_SCRATCH=0x1e000
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_PAD=0x200
    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0x10000
    CONFIG_MCUBOOT_NRF_CLEANUP_PERIPHERAL=y
    CONFIG_BOOT_SIGNATURE_KEY_FILE="C:/Vitalmark/keys/private.pem"
    # CONFIG_BOOT_NRF_EXTERNAL_CRYPTO is not set
    CONFIG_BOOT_ERASE_PROGRESSIVELY=y
    # CONFIG_BOOT_IMAGE_ACCESS_HOOKS is not set
    CONFIG_MCUBOOT=y
    CONFIG_BOOT_USE_TINYCRYPT=y
    # CONFIG_NRF_CC310_BL is not set
    #
    # MCUBoot settings
    #
    # CONFIG_SINGLE_APPLICATION_SLOT is not set
    # CONFIG_BOOT_SIGNATURE_TYPE_NONE is not set
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Here is build/mcuboot/zephyr/.config for the Peripheral LBS sample

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #
    # MCUboot-specific configuration options
    #
    # CONFIG_BOOT_USE_MIN_PARTITION_SIZE is not set
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_SCRATCH=0x1e000
    CONFIG_PM_PARTITION_SIZE_MCUBOOT_PAD=0x200
    CONFIG_PM_PARTITION_SIZE_MCUBOOT=0xc000
    CONFIG_MCUBOOT_NRF_CLEANUP_PERIPHERAL=y
    CONFIG_BOOT_SIGNATURE_KEY_FILE="root-rsa-2048.pem"
    CONFIG_BOOT_ERASE_PROGRESSIVELY=y
    # CONFIG_BOOT_IMAGE_ACCESS_HOOKS is not set
    CONFIG_MCUBOOT=y
    CONFIG_BOOT_USE_MBEDTLS=y
    # CONFIG_NRF_CC310_BL is not set
    #
    # MCUBoot settings
    #
    # CONFIG_SINGLE_APPLICATION_SLOT is not set
    # CONFIG_BOOT_SIGNATURE_TYPE_NONE is not set
    CONFIG_BOOT_SIGNATURE_TYPE_RSA=y
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    I am new to zephyr but looking at them side to side they don't seem to have any major differences.

  • tonyh said:
    When I test the Peripheral LBS, I get much faster upload speed, around 5.5kbps.

    Do you test Peripheral LBS sample on the same board as your app? I found the board configs are different.