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

sd_flash_page_erase error 0x10

My environment: Softdevice S110_5.2.1 NRF51822 QFAAC0 keil version 4 Project : ble_app_proximity

leds_init();
timers_init();
gpiote_init();
buttons_init();
ble_stack_init();
bond_manager_init();

ble_stack_init return NRF_SUCCESS; then bond_manager_init calls pstorage_init On pstorage_init: ... retval = sd_flash_page_erase(PSTORAGE_SWAP_ADDR / PSTORAGE_FLASH_PAGE_SIZE); retval error code 0x10. Any suggestion is welcome.

  • The most common returned error codes are listed above the function, please see below. You can find the hexadecimal error code by right click->Go To Definition Of 'NRF_ERROR_INVALID_ADDR'. This will point you to nrf_error.h where you can see that error code 0x10 is NRF_ERROR_INVALID_ADDR.

    It may not be the source of the issue you are seeing, I just want to make you aware that QFAAC0 is an old version of nRF51822. It is the first revision, and from the nRF51 Series Compatibility Matrix you can see that it is only compatible with SoftDevice S110 version 5.2.1, and SoftDevice 5.2.1 is only compatible with SDK 4.4.2.

    /**@brief Flash Erase page
     *
     * Commands to erase a flash page
     *
     * This call initiates the flash access command, and its completion will be communicated to the
     * application with exactly one of the following events:
     *      - NRF_EVT_FLASH_OPERATION_SUCCESS - The command was successfully completed.
     *      - NRF_EVT_FLASH_OPERATION_ERROR   - The command could not be started.
     *
     * @note
     *      - This call takes control over the radio and the CPU during flash erase and write to make sure that
     *        they will not interfere with the flash access. This means that all interrupts will be blocked
     *        for a predictable time (depending on the NVMC specification in nRF51 Series Reference Manual
     *        and the command parameters).
     *
     *
     * @param[in]  page_number Pagenumber of the page to erase
     * @retval ::NRF_ERROR_INTERNAL      If a new session could not be opened due to an internal error.
     * @retval ::NRF_ERROR_INVALID_ADDR  Tried to erase to a non existing flash page.
     * @retval ::NRF_ERROR_BUSY          The previous command has not yet completed.
     * @retval ::NRF_ERROR_FORBIDDEN     Tried to erase a protected page.
     * @retval ::NRF_SUCCESS             The command was accepted.
     */
    SVCALL(SD_FLASH_ERASE_PAGE, uint32_t, sd_flash_page_erase(uint32_t page_number));
    
Related