<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83806/mcuboot-mcumgr-image-in-the-secondary-slot-is-not-valid</link><description>Hi! 
 I am working on a custom board and would like to use an external flash for BLE OTA updates. The FW is based on NCS v1.7.1 and MCUBoot as the bootloader. I would like to use the MX25R64 external flash connected via SPI (not QSPI) for the secondary</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 Jan 2022 15:58:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83806/mcuboot-mcumgr-image-in-the-secondary-slot-is-not-valid" /><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/349613?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 15:58:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf21ab4f-5544-4632-8316-3edc011695c5</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;br /&gt;&lt;br /&gt;the workaround also fixed the issue on my side and helps a lot.&lt;br /&gt;&lt;br /&gt;Many thanks for the great support and forwarding the issue for further investigation!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/349540?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 13:13:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ca64d1a-35e2-4338-80e7-f01f36e3f37c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I believe I found the source of the issue, which also explains why it was working with one project, and not the other, atleast on my end of things.&lt;/p&gt;
&lt;p&gt;It is this errata:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_198.html#anomaly_840_198"&gt;https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_198.html#anomaly_840_198&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try using &amp;quot;spi2&amp;quot; instead in the boards/nrf52840dk_nrf52840.overlay and child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay and see if this fixes the issue on your end as well? I do not have a better workaround at this moment, but I will ofcourse report this internally for further investigation.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/349429?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 08:05:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6b90028e-b63b-434e-bc2d-bdb7a2c098dd</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Hi H&amp;aring;kon,&lt;br /&gt;&lt;br /&gt;thanks for the sample code. I am glad you can reproduce the problem. I tested your sample with NCS version v1.8.0 and I see the same issue.&lt;br /&gt;&lt;br /&gt;Another strange behaviour is that the image verification works when using the DeviceManger app or the internal hci device of a Linux PC for the image upload, but fails when using an hci_uart device.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/349220?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 11:39:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1cca5574-1ec6-4758-9eec-6d4e0d78ca24</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I am sorry, I must have misunderstood the scenario here. Given the speed you got, I assumed that you were referring to nRF5 sdk implementation, but yes; you can get this speed with mcumgr if overwriting the same image, it seems.&lt;/p&gt;
[quote user="Tom_H"]- Fails: peripheral with secondary slot on external flash (SPI) -&amp;gt; our usecase (example above)[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I setup hci_uart with this setup, and tried it locally. I can see that the issue is present on my side as well:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.6.99-ncs1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: test
E: Image in the secondary slot is not valid!
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1  ***
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The strange part is that if I manually program the &amp;quot;app_update_test.hex&amp;quot; into the primary slot, the hash of the image is equal to when I&amp;#39;m doing the same procedure over-the-air, which indicates that there&amp;#39;s a problem with the moving the image from SPI-flash to internal flash. I am not sure where the issue is in your test-application.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this sample and see if the same issue occurs on your end?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/smp_5F00_svr_5F00_nrf52840dk_5F00_spi_5F00_nor.zip"&gt;devzone.nordicsemi.com/.../smp_5F00_svr_5F00_nrf52840dk_5F00_spi_5F00_nor.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Note: this one advertises as &amp;quot;Zephyr&amp;quot;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348968?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 14:35:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:352cddba-1c0b-4ca4-941b-f026fe73028c</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Many thanks for the support.&lt;br /&gt;&lt;br /&gt;Does this mean that at the current state we cannot use a dongle as HCI device for BLE OTA if the secondary bootloader slot of the peripheral device is located on external flash and connected via SPI?&lt;br /&gt;&lt;br /&gt;I have tested the following combinations with MCUmgr CLI and a nordic dongle as HCI device on a Linux system to update a BLE peripheral device:&lt;br /&gt;- Works: peripheral with secondary slot on internal flash&lt;br /&gt;- Works: peripheral with secondary slot on external flash (QSPI)&lt;br /&gt;- Fails: peripheral with secondary slot on external flash (SPI) -&amp;gt; our usecase (example above)&lt;br /&gt;&lt;br /&gt;Our custom senosr node (peripheral device) is already in production and we need a redesign if the update process doesn&amp;#39;t work. At the moment we are using the old nRF5 SDK with the included bootloader and are working on porting the application to NCS and Zephyr.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348932?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 12:53:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:998bdfa5-1060-4365-99be-789d5ce31971</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Thomas,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As mentioned, this is unfortunately the state of the image transfer at this time. I have inputted this as an internal improvement report. We are continuously trying to improve our deliveries, and speed of the transfer is one of the areas we&amp;#39;re trying to improve. However, as of writing this answer (latest stable version NCS v1.8.0), the speed is approx. 3kB/s.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348912?ContentTypeID=1</link><pubDate>Fri, 21 Jan 2022 12:20:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5fb7ccef-f149-4efe-a1e1-43aa34211f7c</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Thanks for your response.&lt;br /&gt;&lt;br /&gt;Is there a way to reduce the image transfer speed using a Nordic Device with BLE HCI firmware to make BLE OTA work for our intended production environment? Our Gateway is based on a custom board with a Raspberry PI compute module and a pre-certified nRF52840 module.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348642?ContentTypeID=1</link><pubDate>Thu, 20 Jan 2022 08:47:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e9897cbd-b7a7-400b-a88a-faa062b5c49a</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Tom_H"]I further investigated the error and I think it is somehow related to the image transfer speed. Instead of a Raspberry Pi I used a PC with Ubuntu and did several tests. Before each test I erased the external flash[/quote]
&lt;p&gt;I am glad to hear that you got it working!&lt;/p&gt;
[quote user="Tom_H"]The update process works when using the internal HCI device. Upload speed is around 3.0 KiB/s and it took 1m7s.&lt;br /&gt;&lt;br /&gt;When I use the Nordic Dongle with BLE HCI firmware the update process fails. In this case upload speed is about 11,8 KiB/s and takes about 16 seconds.&lt;br /&gt;&lt;br /&gt;Do you have any advice?[/quote]
&lt;p&gt;I see the same speed at my end. Unfortunately, this is a current restriction with updating. I have opened up an internal improvement report to look at the speed of the overall DFU process.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348584?ContentTypeID=1</link><pubDate>Wed, 19 Jan 2022 18:31:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d210c7aa-987b-4435-8687-2eb0222ab6b2</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;I further investigated the error and I think it is somehow related to the image transfer speed. Instead of a Raspberry Pi I used a PC with Ubuntu and did several tests. Before each test I erased the external flash&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog --qspieraseall&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The update process works when using the internal HCI device. Upload speed is around 3.0 KiB/s and it took 1m7s.&lt;br /&gt;&lt;br /&gt;When I use the Nordic Dongle with BLE HCI firmware the update process fails. In this case upload speed is about 11,8 KiB/s and takes about 16 seconds.&lt;br /&gt;&lt;br /&gt;Do you have any advice?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348552?ContentTypeID=1</link><pubDate>Wed, 19 Jan 2022 14:45:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e30278c-fbb8-4cd7-9f79-3af63358aebb</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Thanks for the info.&lt;br /&gt;&lt;br /&gt;The configuration for the larger MTU size has already been set.&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Setting the MTU configuration from the throughput example fixes the allocation problem, but the image verification error remains the same&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_BUF_ACL_TX_COUNT=40
CONFIG_BT_L2CAP_TX_BUF_COUNT=40
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_L2CAP_TX_MTU=247
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: none
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
Starting Bluetooth Peripheral LBS example
build time: Jan 19 2022 15:31:58
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fd0
I: data wra: 0, 1c
I: SoftDevice Controller build revision: 
I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
I: 9d d3 a2 95 88 f6 30 0a |......0.
I: 7f 53 49 fd             |.SI.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
Connected
I: Swap type: none
Disconnected (reason 19)
Connected
I: Swap type: none
I: Swap type: none
Disconnected (reason 8)
Connected
I: Swap type: none
I: Swap type: none
Disconnected (reason 19)
Connected
I: Swap type: none
I: Swap type: test
I: Swap type: test
Disconnected (reason 19)
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=good, swap_type=0x4, copy_done=0x1, image_ok=0x1
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: test
E: Image in the secondary slot is not valid!
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
Starting Bluetooth Peripheral LBS example
build time: Jan 19 2022 15:31:58
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fd0
I: data wra: 0, 1c
I: SoftDevice Controller build revision: 
I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
I: 9d d3 a2 95 88 f6 30 0a |......0.
I: 7f 53 49 fd             |.SI.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;But I think the problem is related to buffer or SPI configuration, cause the image upload throughput is much higher when using MCUmgr and it works in combination with QSPI.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348520?ContentTypeID=1</link><pubDate>Wed, 19 Jan 2022 13:35:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4f422e5f-636a-4496-91bf-97a84ca8e448</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Looks like there&amp;#39;s a problem allocating TX packets at your end, this could be due to the bluetooth mtu that your bluetooth host uses. Could you try the following configs&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2304&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348504?ContentTypeID=1</link><pubDate>Wed, 19 Jan 2022 12:54:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a4d8fb1-a146-46bb-907f-5f38f8698dca</guid><dc:creator>Tom_H</dc:creator><description>&lt;p&gt;Many thanks for the fast response!&lt;br /&gt;I followed your steps but still get the same error message.&lt;br /&gt;&lt;br /&gt;As a first step, I erased the flash and QSPI flash&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -e
nrfjprog --reset
nrfjprog --qspieraseall&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Than I build and flashed the sample using NCS v1.7.1&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;west build -p always -b nrf52840dk_nrf52840
west flash&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I rebuilt the sample application, copied the update binary to a Raspberry Pi and uploaded the image using MCUmgr&lt;pre class="ui-code" data-mode="text"&gt;ubuntu@ubuntu:~$ sudo go/bin/mcumgr -c ble_lbs image upload app_update.bin
 200.50 KiB / 200.50 KiB [======================================================================] 100.00% 9.76 KiB/s 20s
Done&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;List the images&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ubuntu@ubuntu:~$ sudo go/bin/mcumgr -c ble_lbs image list
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: 30372ead86b3fe06019e4c90d02c2b680bd97195ddc91f20cc5ec68b7516a4a6
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags:
    hash: 56385894ea602db72850094e158c58afb4925607790ce3d79d64b1024a2a3d3d
Split status: N/A (0)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Triggered an image test and reset the device using nrfjprog&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ubuntu@ubuntu:~$ sudo go/bin/mcumgr -c ble_lbs image test 56385894ea602db72850094e158c58afb4925607790ce3d79d64b1024a2a3d
3d
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: 30372ead86b3fe06019e4c90d02c2b680bd97195ddc91f20cc5ec68b7516a4a6
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: pending
    hash: 56385894ea602db72850094e158c58afb4925607790ce3d79d64b1024a2a3d3d
Split status: N/A (0)&lt;/pre&gt;&lt;br /&gt;However, testing the image fails with the same error message&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: none
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
Starting Bluetooth Peripheral LBS example
build time: Jan 19 2022 13:30:44
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fe8
I: data wra: 0, 0
I: SoftDevice Controller build revision: 
I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
I: 9d d3 a2 95 88 f6 30 0a |......0.
I: 7f 53 49 fd             |.SI.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
Connected
I: Swap type: none
Disconnected (reason 19)
Connected
I: Swap type: none
I: Swap type: none
E: Unable to allocate TX context
E: Unable to allocate TX context
E: Unable to allocate TX context
E: Unable to allocate TX context
Disconnected (reason 8)
Connected
I: Swap type: none
I: Swap type: none
Disconnected (reason 19)
Connected
I: Swap type: none
I: Swap type: test
I: Swap type: test
Disconnected (reason 19)
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: test
E: Image in the secondary slot is not valid!
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
Starting Bluetooth Peripheral LBS example
build time: Jan 19 2022 13:30:44
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fd0
I: data wra: 0, 1c
I: SoftDevice Controller build revision: 
I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
I: 9d d3 a2 95 88 f6 30 0a |......0.
I: 7f 53 49 fd             |.SI.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Did I do something wrong?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Thomas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MCUBoot + MCUmgr: Image in the secondary slot is not valid!</title><link>https://devzone.nordicsemi.com/thread/348430?ContentTypeID=1</link><pubDate>Wed, 19 Jan 2022 08:46:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8639b350-73ff-4a43-b024-0fde35fe31c8</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for providing your test firmware.&lt;/p&gt;
&lt;p&gt;I tried to replicate the issue you are seeing using these commands on the PC side:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="text"&gt;sudo /path/to/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name=&amp;#39;Nordic_LBS&amp;#39; image upload zephyr/app_update.bin&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the &amp;quot;image list&amp;quot; after successful upload:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sudo /path/to/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name=&amp;#39;Nordic_LBS&amp;#39; image list
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: 970ee41e6186bebf631aab7aebbc7c7ae0d6b027ac8149f782104c06884673b7
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: 
    hash: 24bc32212e7cc352aafc82a5143dd3f79bd9819869c548dacaf41d2e2eddfe11
Split status: N/A (0)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now test the second image and see that it is set to &amp;quot;pending&amp;quot; successfully:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;sudo /path/to/mcumgr --conntype ble --connstring ctlr_name=hci0,peer_name=&amp;#39;Nordic_LBS&amp;#39; image test 24bc32212e7cc352aafc82a5143dd3f79bd9819869c548dacaf41d2e2eddfe11
Images:
 image=0 slot=0
    version: 0.0.0
    bootable: true
    flags: active confirmed
    hash: 970ee41e6186bebf631aab7aebbc7c7ae0d6b027ac8149f782104c06884673b7
 image=0 slot=1
    version: 0.0.0
    bootable: true
    flags: pending
    hash: 24bc32212e7cc352aafc82a5143dd3f79bd9819869c548dacaf41d2e2eddfe11
Split status: N/A (0)
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And here&amp;#39;s the output after reset where you can see that the timestamp has changed (image tested OK):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: none
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
Starting Bluetooth Peripheral LBS example
build time: Jan 19 2022 09:25:17
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fd0
I: data wra: 0, 1c
I: SoftDevice Controller build revision: 
I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
I: 9d d3 a2 95 88 f6 30 0a |......0.
I: 7f 53 49 fd             |.SI.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
Connected
I: Swap type: none
I: Swap type: test
I: Swap type: test
Disconnected (reason 19)
Connected
Disconnected (reason 19)
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
I: Starting bootloader
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
I: Boot source: none
I: Swap type: test
I: Bootloader chainload address offset: 0xc000
*** Booting Zephyr OS build v2.6.99-ncs1-1  ***
Starting Bluetooth Peripheral LBS example
build time: Jan 19 2022 09:33:22
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fd0
I: data wra: 0, 1c
I: SoftDevice Controller build revision: 
I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
I: 9d d3 a2 95 88 f6 30 0a |......0.
I: 7f 53 49 fd             |.SI.    
I: No ID address. App must call settings_load()
Bluetooth initialized
Advertising successfully started
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Debugging MCUBoot with Ozone shows that the image signature/hash is incorrect when using MCUmgr CLI for the image upload. Further investigation of the error shows that the integrity check perforrmed in the &lt;em&gt;bootutil_img_validate&lt;/em&gt; function &lt;em&gt;&lt;/em&gt; fails. In this case the variable&amp;nbsp;&lt;em&gt;hash&lt;/em&gt; &lt;em&gt;&lt;/em&gt; is invalid, but the content of the variable&amp;nbsp;&lt;em&gt;buf &lt;/em&gt; is correct. When I use the Device Manager App to&amp;nbsp; upload the image, the signature is valid and the update is successful.[/quote]
&lt;p&gt;If the hash is incorrect, then there&amp;#39;s a problem with the integrity of the image. Since you are working with a nRF52840-DK, could you try to erase the flash and QSPI flash?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfjprog -e
nrfjprog --reset
nrfjprog -qspieraseall&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then flash your sample.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>