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

flash memory

Hi,

I am using the flash memory for a few variables and it works very well. Now I have one flag which is defined by #define statement and if it is enable then the initial flash space together with initial values of variables are defined. If flag is not defined then the program knows that it can read values of variables from flash and they were defined in past. This procedure works very good but the problem is that in first step I have to load the program with #define flag statement and subsequently the same program without #define flag statement. Of course it is really time consuming procedure because of that I would like to know if it is possible to do in one step that I can load only one program on nrf chip.

Best regards

Samo

Parents
  • This sounds like programming 101 and not really a specific Nordic device question.

    Why not just erase all the flash. Then in your program check if a magic number is in a specific location in flash.

    If the Flash location is blank (0xFF ) the magic number is not present, so your software must copy the data (and the magic number) to the flash.

    Then the next time you run the program, it checks the Flash it will find the magic number, so you can read the data from flash as you know it has been initialised

Reply
  • This sounds like programming 101 and not really a specific Nordic device question.

    Why not just erase all the flash. Then in your program check if a magic number is in a specific location in flash.

    If the Flash location is blank (0xFF ) the magic number is not present, so your software must copy the data (and the magic number) to the flash.

    Then the next time you run the program, it checks the Flash it will find the magic number, so you can read the data from flash as you know it has been initialised

Children
No Data
Related