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

Pstorage with S210 softdevice

Hi Nordic!

Long time short, I want to do an ANT application (S210, nRF51422) that pairs two slaves to one master. I have configured everything such that it pairs only when the master is close to the slaves. Now, I want that, when I send a determined message to the slaves, they save that channel ID information in some non-volatile memory (flash).

I am trying to do this using the driver pstorage, but I am having a lot of troubles to set it up. I have seen that other people (devzone.nordicsemi.com/.../) have had the same problem, but still am not able to solve the problem.

The kind of errors I am getting, are the same that the guy from that question I referenced had:

ble.h missing, but when I solve it I get more different errors.

Is there any easy way of doing this? Has anyone tried to do this as well? I would appreciate if someone had an example of writing in flash using S210 softdevice.

Thanks a lot!

  • Ups, another detail that arised while going a bit further: when the microprocessor comes from the factory, what is the content of the flash memory, without doing nothing? Is it completely random? is it 0xFF? I need to know this value with 100% certainty, since I want to use one non-volatile byte to say that the device has been paired before, or that it hasn't.

    Thanks!

  • Great! If you are going to write to the same part of memory you need to erase the complete page first. This is how flash works. You can write to different parts of the page once, but if you want to write to a part more than once you need to erase the complete page.

    From our factory it will be 0xFF, but you can of course erase the complete flash before you flash it with your program. Or read the flash memory with the programmer and check the flash is actually 0xFF.

Related