This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF Storage BUSY Error

I am implementing the BLE buttonless DFU 

SDK 14.2,

GCC compiler

softdevice 5.0.0

While writing the firmware data I am getting this error

00> INFO: ../../components/libraries/bootloader/dfu/nrf_dfu_flash.c +136 nrf_fstorage_write() failed with error 0x4.


00> INFO: ../../bootloaderVista/dfu_req_handling.c +1025 Failed 128 B address: 0x00047880

I tried increasing the NRF_FSTORAGE_SD_QUEUE_SIZE 1280

NRF_FSTORAGE_SD_MAX_RETRIES 16 

NRF_FSTORAGE_SD_MAX_WRITE_SIZE 128

I am writing data at 20 bytes per 2 ms after creating the data object successfully.

Any suggestion!!

  • Hello,

    Is dfu_req_handling.c a custom file? If so, I can't say why it fails.

    Have you seen our implementation on the buttonless_dfu example in combination with our bootloader from the SDK?

    By the look of things, if nrf_fstorage_write() returns NRF_ERROR_BUSY, it probably means that you are writing too fast to the flash. What decides how fast you call this?

    BR,
    Edvin

  • Hey,

    I am successful in working with BLE DFU, but now I am trying to implement the SPI bootloader where I am reading the NRF firmware file from the external memory.

    With BLE I had observed that Data transfer speed to quiet fast that currently I am using.
    And also I tried to slow down data speed to 20 bytes per 20 ms, but still getting the same results.

  • Hello,

    if nrf_fstorage_write returns 4, it means NRF_ERROR_NO_MEM. From the header file, nrf_fstorage.h:

    /**@brief   Function for writing data to flash.
     *
     * Write @p len bytes from @p p_src to @p dest.
     *
     * When using @ref nrf_fstorage_sd, the data is written by several calls to @ref sd_flash_write if
     * the length of the data exceeds @ref NRF_FSTORAGE_SD_MAX_WRITE_SIZE bytes.
     * Only one event is sent upon completion.
     *
     * @note The data to be written to flash must be kept in memory until the operation has
     *       terminated and an event is received.
     *
     * @param[in]   p_fs        The fstorage instance.
     * @param[in]   dest        Address in flash memory where to write the data.
     * @param[in]   p_src       Data to be written.
     * @param[in]   len         Length of the data (in bytes).
     * @param[in]   p_param     User-defined parameter passed to the event handler (may be NULL).
     *
     * @retval  NRF_SUCCESS                 If the operation was accepted.
     * @retval  NRF_ERROR_NULL              If @p p_fs or @p p_src is NULL.
     * @retval  NRF_ERROR_INVALID_STATE     If the module is not initialized.
     * @retval  NRF_ERROR_INVALID_LENGTH    If @p len is zero or not a multiple of the program unit,
     *                                      or if it is otherwise invalid.
     * @retval  NRF_ERROR_INVALID_ADDR      If the address @p dest is outside the flash memory
     *                                      boundaries specified in @p p_fs, or if it is unaligned.
     * @retval  NRF_ERROR_NO_MEM            If no memory is available to accept the operation.
     *                                      When using the @ref nrf_fstorage_sd, this error
     *                                      indicates that the internal queue of operations is full.
     */
    ret_code_t nrf_fstorage_write(nrf_fstorage_t const * p_fs,
                                  uint32_t               dest,
                                  void           const * p_src,
                                  uint32_t               len,
                                  void                 * p_param);

    Do you use the softdevice or NVMC backend in your bootloader?

    It may look like you still are writing too fast then. I don't know how you implemented your custom bootloader.

  • In custom bootloader I had tried slowing down the process by 20 bytes per 100 ms, still getting this error,

    I am using softdevice backend in bootloader.

    I just change the data input from BLE to SPI and everything remain same but still getting this issue.

  • You should look into the application logic. If you call the flash write calls from within an interrupt, perhaps the chip doesn't release this interrupt, not allowing the fstorage module to write anything?

Related