This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Which are different memory storage option?

Hello, I am using pca10028 and sdk 12.2. I have interfaced temp sensor with nrf51 and now I want to store that data continuously in memory of nrf51. I want to store min 4k sample consisting of 2 bytes of data. So should I prefer fds or pstorage or fstorage? Can I get example code to do this? Also I am am facing difficulty in displaying output through uart although code doesnt gives me error. I am attaching my code . Please let me know suggestions. Thanks, Shailav

error - debug1.PNG

  • FormerMember
    0 FormerMember

    For storing data, I would recommend using FDS. With FDS it is easy to store and retrieve data. FDS uses the fstorage module. Pstorage is the old storage module, and it is no longer being updated.

    For how to use FDS with the softdevice, you can take a look at the example ble_app_hrs-fds-test-github.zip in this answer.

    When adding FDS and using BLE, you will need to add the following in addition to what is in the documentation on the infocenter:

    static void sys_evt_dispatch(uint32_t sys_evt)
    {
        // Dispatch the system event to the fstorage module, where it will be
        // dispatched to the Flash Data Storage (FDS) module.
        fs_sys_event_handler(sys_evt);
       ...
    }
    
    
    static void ble_stack_init(void)
    {
        ...
        err_code = softdevice_sys_evt_handler_set(sys_evt_dispatch);
        APP_ERROR_CHECK(err_code);
    } 
    

    For explanation on why that code section is needed, see this answer.

  • Hi, I am trying your suggestions. Meanwhile can you look at my code and suggest me why my uart is not working. There is so much that I want to printf on console. Thanks

  • FormerMember
    0 FormerMember in reply to FormerMember

    For logging, I would recommend you to use the NRF_LOG module. It is being used in all of our examples. The configurations for the NRF_LOG module can be found in sdk_config.h.

  • Hi, I want to add my temp sensor data to the flash memory and then I want to access this data and send to app via ble. Can you help me to edit code? I am attaching my main.c file above. I dont know how to access flash. Thanks, Shailav

  • FormerMember
    0 FormerMember in reply to FormerMember

    The FDS example I linked to in my first answer shows how to store data to flash using FDS.

Related