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

nrf sleep without losing connection, (Power efficiency)

Hi,

I designed a pcb using nrf51 chip with some sensors, this pcb should read ,every minutes, all values from sensors and saves them into the flash memory beside that it should update the value of the characteristic that represent the sensors data. Theses characteristics have to notify the phone every minute about the new characteristics values.

The one minutes routine is done thanks to an external PCF that trigger the nrf through the input interrupt.

All this work are done and work perfectly, but what I want to do is to put the nrf51 into sleep mode the most of the time and only wake him up each minutes only to read the sensors values, save them and update the characteristic to notify the phone about the new values.

My questions are :

1- Is that possible for the nrf and the phone to keep connection while the nrf go to sleep mode for a minute?

2- in case I separate the PCB and the phone form each other for 30 minutes and them I bring them back close together. Will the connection will be kept or should I open the phone and make the connection again ? I don't want to establish manually the connection every time I separate both of device.

3- I read when nrf51 is wake up after a sleep is like restaring it, so it gonna normally start executing the code from the beginning and execute the init function of different periphal ? How can I avoid that and let the nrf exceute only a portion of the code that I want for him to execute and not restaring the whole system.

4- if the nrf is during the sleep mode and I want to wake him up with my phone through Bluetooth, is that possible? This like the input pin interrupt which can wake up the nrf from the sleep mode.

little resume of what i want : turn on the PCB and open phone APP and establish connection, the PCB go to sleep mode and wake up every minute to read and update the characteristic so the phone can be notified and then go back to sleep mode. the connection should be kept even if separate the NRF PCB from the phone for a long time.

FI :the code that i'm using for the nrf I took it from the tutorial : devzone.nordicsemi.com/.../

regards,

  • I assume that you are talking about System OFF mode when you say sleep mode.

    1. No, the connection requires the chip to be running. However, you can keep the chip in System ON IDLE mode (consumes about 4uA) most of the time and set the connection interval to 4 seconds (maximum interval) to keep the connection alive. This would not require much current.

    2. The connection will be lost. You could theoretically make the phone auto-connect to your device if you create your own app, but that would require the phone to be scanning all the time while it's not in connection, and that would consume a lot of current. Also, the nRF51 must be advertising.

    3. When the device resumes from System OFF most of the peripheral registers are erased and need to be initialized again. You can turn on RAM retention on some of the RAM blocks to retain data while in system OFF, and then, when you wake up, you can check if the reset reason was "System OFF" (RESETREAS register), and then choose to not initialize the data already stored in RAM. What code do you have that you think you would not need to run when the chip starts up?

    4. No, when in System OFF the chip is not running, and the Softdevice with BLE is definitely not running.

Related