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

How to retain variables data after disconnecting from the device?

Hi,

I am scanning from my nRF52840 and connects to one peripheral and i have written code to get it's Device information(DIS) and i stored all these information in some variables and now i need to connect another peripheral and pass Model number(previously got from DIS) using Nordic uart service.

After disconnecting from one peripheral and trying to connect to other device  my previous data is being lost.

How can i do it,is there any other example for my problem?

Parents
  • Data in a variable can't be "lost", you are either overwriting the data somewhere in your application, or you are going to system OFF (for instance calling sd_power_system_off()), or you have an assert. If you have an assert then the application typically will do a soft reset (for instance calling NVIC_SystemReset()) in the assert callback handler.

  • Yes Kenneth,i am pressing reset button on my nRF52840 board because i need to connect other peripheral(without reset i cannot scan again and connect to other device).

    Here my requirement is to  connect multiple peripherals which has different device names and collect data(characteristics values) of one peripheral store in  central and pass these data to another peripheral.

    Is there any possibility to store global data even after reset?

    How multiperipheral_central example work with different device names?

Reply
  • Yes Kenneth,i am pressing reset button on my nRF52840 board because i need to connect other peripheral(without reset i cannot scan again and connect to other device).

    Here my requirement is to  connect multiple peripherals which has different device names and collect data(characteristics values) of one peripheral store in  central and pass these data to another peripheral.

    Is there any possibility to store global data even after reset?

    How multiperipheral_central example work with different device names?

Children
Related