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

How to write uint8_t some_array via FDS ?

Hello everyone,

I use sdk14.2 softdevice S132. I want to write "uint8_t some_array [7] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};" with use fds_write and read the array from the memory location and store the array into another array. Prosses like this;

1- Write the array  "uint8_t some_array [7] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};" to memory via FDS

2- Read the array from address location (fds_read)

3- Store the read array into another array (for example second_array(7)).

4- Finally, to be sure, we should read this sequence in this way;

NRF_LOG_HEXDUMP_INFO(second_array,7); 

and result have to be;

 0> <info> app:  00 01 02 03 04 05 06   |....... 

I read some document and examine some example, but I did not see how to write a sequence with multiple elements into flash memory.

Do you have any suggestion?

Parents
  • Hi Ugur

    Have you had a look at the fstorage example in the SDK?

    If you are looking for a simple library to read and write one or more bytes to flash I think fstorage is the better choice. FDS is more sophisticated, but might be a bit overkill for what you are trying to do. 

    Best regards
    Torbjørn

  • Hi ovrebekk, thanks for your answer. I have a few questions;

    Q-1 Do I have to use the Cli.c library? If no, how to read array and then  store it into another array ?

    Q-2 Is there an example of FDS that I have described above (uint8_t some_array [7])?

    I looked the LINK, but it wrote "static uint32_t const m_deadbeef[2] = {0xDEADBEEF,0xBAADF00D};"  This is not exactly what I want to learn. "uint8_t some_array [7] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};" I want to save it and read it, then copy it to another array. 

Reply
  • Hi ovrebekk, thanks for your answer. I have a few questions;

    Q-1 Do I have to use the Cli.c library? If no, how to read array and then  store it into another array ?

    Q-2 Is there an example of FDS that I have described above (uint8_t some_array [7])?

    I looked the LINK, but it wrote "static uint32_t const m_deadbeef[2] = {0xDEADBEEF,0xBAADF00D};"  This is not exactly what I want to learn. "uint8_t some_array [7] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06};" I want to save it and read it, then copy it to another array. 

Children
Related