DFU data not being written to external flash

Description:
We are working with nRF54L15 connected to an external flash memory MX25R64.
Our setup uses MCUboot with a secondary partition located on the external flash.

For firmware updates we are using the dfu_target library. The implementation logic is based on the fota_download library, which also relies on dfu_target.

We moved the firmware update process into a dedicated task, which receives data chunks via a queue and then processes them through dfu_target.

Issue observed:

  • When running normally (without debugging session started), data is not written to the external flash (secondary MCUboot partition).

  • When a debugging session started, the same update procedure works correctly, and all chunks are written to flash as expected.

Questions:

  1. Are there known issues with dfu_target + MCUboot when writing to external flash on nRF54L15?

  2. Could this behavior (works with debugger, fails without) be related to timing or power/clock domain issues with the external flash?

  3. Do you have recommendations for debugging or configuring external flash writes in this setup?

  4. Could this issue be caused by a conflict with settings_save_one() or other settings subsystem flash operations?

  5. Could BLE activity or timing constraints block access to the external SPI flash during DFU writes?

Environment:

  • Controller: nRF54L15

  • External flash: MX25R64 SPI NOR (used for MCUboot secondary partition)

  • Zephyr RTOS (SDK 3.0.2)

  • MCUboot

  • dfu_target library (custom integration)

  • Hello,

    I can't think of any explanation for why it works during an active debug session, but when not debugging, the app runs normally without errors but skips all writes to external flash. Is UART logging available on this board so you can check what happens when not in debug mode?

    Best regards,

    Vidar

  • Hi Vidar,

    Thanks for the reply. Yes, the logs are enabled. No errors occur.  Here’s some additional context from our testing:

    • We are writing 4 KB chunks to the external MX25R64 flash (secondary partition managed by MCUBOOT).

    • Flash dumps using nrfutil show that chunks are only partially written when not debugging: sometimes only the beginning, middle, or end of a chunk is actually stored.

    • No errors are reported by dfu_target_mcuboot_write(), and all Zephyr logging calls succeed.

    • When we run the DFU logic through a work queue instead of a separate thread, the writes succeed only if we add logging calls immediately before the write, e.g.:

    for (int i = 0; i < 50; i++) {
        LOG_INF("Dummy log");
    }
    err = dfu_target_mcuboot_write(data->rx_chunk_buf, data->len);
    

    We suggests a timing or synchronization issue. Logging seems to “help” the writes complete correctly. With this workaround, we were able to upload a full firmware image. We also observed an issue with the image swap: the swap succeeds only when debugging (the magic number is read correctly), otherwise the swap may fail.

  • Hi, 

    This seems very strange, and I haven’t been able to find any similar reports of it. Are you able to test the same code on a nRF54L15 DK to see if you get the same result?

  • Yes, the problem reproduces on the devkit. I prepared an example based on our configuration.

    So you can try it yourself.

    repository

  • Thanks. Yes, I was able to reproduce. The problem occurs when the chip enters low power mode between transactions. Your sample also worked when I added NRF_POWER->TASKS_CONSTLAT=1; to the beginning of main().

Related