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

Experimental: Flash Storage Documentation inconsistency

I was looking at the fstorage documentation for SDK 14.2.0 (https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/lib_fstorage.html?cp=4_0_1_3_51)

In this part of the documentation are cited the following event ID for the fstorage callback:

  • NRF_FSTORAGE_WRITE_RESULT
  • NRF_FSTORAGE_READ_RESULT
  • NRF_FSTORAGE_ERASE_RESULT

But in the code I can found only these:

  • NRF_FSTORAGE_EVT_WRITE_RESULT
  • NRF_FSTORAGE_EVT_READ_RESULT
  • NRF_FSTORAGE_EVT_ERASE_RESULT 

defined into nrf_fstorage.h as follow:


/**@brief   Event IDs. */
typedef enum
{
    NRF_FSTORAGE_EVT_READ_RESULT,
    NRF_FSTORAGE_EVT_WRITE_RESULT,  //!< Event for @ref nrf_fstorage_write.
    NRF_FSTORAGE_EVT_ERASE_RESULT   //!< Event for @ref nrf_fstorage_erase.
} nrf_fstorage_evt_id_t;

I also noticed that into explanation, each call (write, read, erase) have its own callback after request's done: this is true for Write and Erase, but the READ callback is never called, and the data are available each time directly after nrf_fstorage_read() function returns (with NRF_SUCCESS).

I think this is a documentation lack/bug, but can you confirm that or am I loosing something?

Can I directly read data after nrf_fstorage_read() function, if it returns NRF_SUCCESS ?

Thanks

Luca

Parents
  • FormerMember
    +1 FormerMember

    1) There is a bug in the documentation, the correct event name are 

    • NRF_FSTORAGE_EVT_WRITE_RESULT
    • NRF_FSTORAGE_EVT_READ_RESULT
    • NRF_FSTORAGE_EVT_ERASE_RESULT 

    2) According to the documentation, the event NRF_FSTORAGE_EVT_READ_RESULT  is being sent to the fstorage callback handler function. However, if you have a look in the code, NRF_FSTORAGE_EVT_READ_RESULT  will never occur, because it is never sent. The flash_fstorage example shows how to read from flash in fstorage_read in cli.c. It shows that you can read the data when nrf_fstorage_read() has returned NRF_SUCCESS.

     

Reply
  • FormerMember
    +1 FormerMember

    1) There is a bug in the documentation, the correct event name are 

    • NRF_FSTORAGE_EVT_WRITE_RESULT
    • NRF_FSTORAGE_EVT_READ_RESULT
    • NRF_FSTORAGE_EVT_ERASE_RESULT 

    2) According to the documentation, the event NRF_FSTORAGE_EVT_READ_RESULT  is being sent to the fstorage callback handler function. However, if you have a look in the code, NRF_FSTORAGE_EVT_READ_RESULT  will never occur, because it is never sent. The flash_fstorage example shows how to read from flash in fstorage_read in cli.c. It shows that you can read the data when nrf_fstorage_read() has returned NRF_SUCCESS.

     

Children
Related