Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Custom TWIS DFU transport in SDK15 on S132v6: Flash erase error 3 on Init Packet execute

Hello!

SDK15's DFU with app_scheduler is great!

I am able to Select, Create, and Write an Init Packet. On Execute, however, I get "Flash erase failed (0x3)". What might I be doing wrong?

In the log below, 'wr' happens in NRFX_TWIS_EVT_WRITE_REQ, 'wd' happens in NRFX_TWIS_WRITE_DONE, etc:

<debug> nrf_dfu_twis: wr
<debug> nrf_dfu_twis: wd
<debug> nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_EXECUTE (command)
<debug> nrf_dfu_validation: PB: Init packet data len: 62
<info> nrf_dfu_validation: Signature required. Checking signature.
<info> nrf_dfu_validation: Calculating init packet hash (init packet len: 62)
<info> nrf_dfu_validation: Verify signature
<info> nrf_dfu_validation: Image verified
<debug> app: Enter nrf_dfu_cache_prepare()
<debug> app: required_size: 0x158D0.
<debug> app: single_bank: false.
<debug> app: keep_app: false.
<debug> app: keep_softdevice: true.
<debug> app: SD_PRESENT: true.
<debug> app: Bank contents:
<debug> app: Bank 0 code: 0x00: Size: 0x0
<debug> app: Bank 1 code: 0x00: Size: 0x158D0
<debug> app: pass: 0.
<debug> app: cache_address: 0x26000.
<debug> app: cache_too_small: false.
<debug> app: keep_firmware: false.
<debug> app: delete_more: false.
<debug> nrf_dfu_validation: Write address set to 0x00026000
<debug> nrf_dfu_settings: Writing settings...
<debug> nrf_dfu_settings: Erasing old settings at: 0x0007F000
<debug> nrf_dfu_flash: nrf_fstorage_erase(addr=0x0x0007F000, len=1 pages), queue usage: 1
<debug> nrf_dfu_flash: Flash erase failed (0x3): addr=0x0007F000, len=0x1 bytes, pending 0
<debug> nrf_dfu_flash: nrf_fstorage_write(addr=0x0007F000, src=0x20007F94, len=440 bytes), queue usage: 1
<debug> nrf_dfu_flash: Flash write failed (0x3): addr=0x0007F000, len=0x1B8 bytes, pending 0
<debug> nrf_dfu_req_handler: Writing valid init command to flash.
<debug> nrf_dfu_req_handler: Request handling complete. Result: 0x1
<debug> nrf_dfu_twis: Sending Response: [0x4, 0x1]
<debug> nrf_dfu_twis:   res len 3
<debug> nrf_dfu_twis: rr
<debug> nrf_dfu_twis: rd

  • The app that will be bootloaded uses the softdevice, but the bootloader does not start the SD. I'm now trying to understand the places where SD_PRESENT and (perhaps) BLE_STACK_SUPPORT_REQD and MBR_SIZE determine sizes and addresses for protection.

    Note that I copied the secure_bootloader_ble example and added the TWIS transport, then removed nrf_dfu_ble.c from the build so there is enough flash to enable logging.

  • I added nrf_dfu_ble.c back into the build (two transports exist) and now flash erase/write works. My issue could be related to something in there making the system understand that is needs to use sd instead of nvmc to handle flash. I want both transports present, so I'm going to mark this as the answer - though any additional information is welcome.

Related