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

Logging realtime sensor data to flash

I would like to know if it is possible to log realtime sensor data to flash while advertising. I would like to have a device which transmits real time ECG data over ble UART to an android device when in range and once out of range, should start logging the data to the nrf51822 flash. It should resume transferring the data to android device once it is in range again and connected. I would be glad if you could give me a clue as to how to realise this if it is possible.

Parents
  • Yes, that is certainly possible. You will have to decide on your approach as there are several ways to crack this nut. If you want to manage the flash yourself there are sd_flash_xxxxxx functions for writing, reading and erasing flash. If you want some abstraction and help managing the flash access you can use the pstorage utility and its API. I also believe there may be a higher level of abstraction through use of a device manager facility but I am not familiar with that.

  • @Kosidinma There is a pstorage example here that uses 1.5 pages in flash (the pstorage_test_multipage_page_aligned function). I think the general rule to follow is to have blocks alligned with pages, i.e. to have block size e.g. 128 or 1024 bytes. Also note the two notes in the pstorage documentation:

    *- In case blocks span across multiple flash pages update and clear of blocks might not work as expected

    • Loading, storing, updating and clearing of each block is supported. A single operation can not be requested for multiple blocks. However, clear is permitted on requested blocks. This is the only exception.*
Reply
  • @Kosidinma There is a pstorage example here that uses 1.5 pages in flash (the pstorage_test_multipage_page_aligned function). I think the general rule to follow is to have blocks alligned with pages, i.e. to have block size e.g. 128 or 1024 bytes. Also note the two notes in the pstorage documentation:

    *- In case blocks span across multiple flash pages update and clear of blocks might not work as expected

    • Loading, storing, updating and clearing of each block is supported. A single operation can not be requested for multiple blocks. However, clear is permitted on requested blocks. This is the only exception.*
Children
No Data
Related