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

Using FDS to store values

Hi,

I want to run my calibration code only once and this data store in flash (using FDS library) and not again even after restart. Is there any example of this kind of usage? or do i need to run calibration code and flash another code and use data stored in flash after calibration?

Parents
  • I don't want to make any advertise here, but I made a small library to save some non volatile variable's, maybe it helps:

    https://github.com/GatzeTech/nRFSnippets/tree/main/NVMC-non_volatile

    I just made it last weekend, it is still quite 'rough' but it works. Be aware in comparison with the FDS library it uses always the same place to store variables in flash, it can wear out if put it accidentally in a while loop or something like that.

  • Using your function my program get stuck on "flash_page_erase()"

  • That's a pity, it alway's hard to get software right under different circumstance's, do you have JTAG/SWD available ?

    If so can you see what the value's are of the registe:

    FICR->CODEPAGESIZE

    FICR->CODESIZE

    FICR->INFO.FLASH

    Which nRF are you using ? and size flash ?

    I guess the given address is not in range, I will adapt the code so it will alway's take the last page, no matter the size of the flash.

  • I am using NRF52840 with softdevice. For connection i have J-Link ultra+ I have 1024 kB version. I do not know where i can find the values you are asking for. I am using Segger.

  • Made a little update, with a function simple_nv_init(); It search for the last page in memory. It is stated in the description on github.

    Anyway, it is up to you what to use, I don't want to hijack this topic or something. But sometimes I think some library's are quite complicated to use, that's why. On the otherhand, it if has to work in all circumstances, than library's get more complicated, anyways, my 2 cents.

    And you can find the register values right bottom.

    Sometimes handy if things don't work like expected.

Reply
  • Made a little update, with a function simple_nv_init(); It search for the last page in memory. It is stated in the description on github.

    Anyway, it is up to you what to use, I don't want to hijack this topic or something. But sometimes I think some library's are quite complicated to use, that's why. On the otherhand, it if has to work in all circumstances, than library's get more complicated, anyways, my 2 cents.

    And you can find the register values right bottom.

    Sometimes handy if things don't work like expected.

Children
Related