0

"Switching off" nRF51 beacon

jthie gravatar image

asked 2016-08-12 03:49:12 +0100

I'm using a nRF51 beacon as a receiver that produces a pulse when it receives a byte from the transmitter. The code is based on the ble_app_uart example. And I set the connection interval to minimum to minimise the latency.

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)             /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(7.5, UNIT_1_25_MS)             /**< Maximum

The beacon is only used every few days and for 1 hour each time. I want to switch off the beacon without pulling the coin battery out or modifying the circuit.

Is it feasible to connect one of the GPIOs to a SPDT switch as a "power switch"? For example, when the pin transitions from high to low, the beacon is powered down (system off) and when the pin transitions from low to high, the beacon is powered up and reset.

Is there any example code to do this with S110 soft device? I have only used an example without the soft device in https://github.com/NordicSemiconducto....

edit retag flag offensive close delete report spam

1 answer

Sort by ยป oldest newest most voted
0
stefanbirnir gravatar image

answered 2016-08-12 13:50:09 +0100

Hi Johnson

Thank you for you questions.

As explained in the nRF51 current consumption guide, System On and System Off low power modes are enabled with the the sd_app_event_wait() and sd_power_system_off() commands respectively when using softdevice.

To get action on a button, but stay in System On low power mode, you can just insert the following code in the bsp_event_handler in the ble_app_uart example:

case BSP_EVENT_KEY_0:
    //Do whatever  
    break;

When you press Button 1 on the nRF51-DK, then your "Do whatever" code will execute. When the key is not pressed, the nRF51 will stay in System On low power mode (CPU disabled) as code execution falls back to the main loop where power_manage() function (sd_app_event_wait) is executed.

To see how to enter System Off with softdevice, an example is shown in e.g. in the sleep_mode_enter() function in the ble_app_uart example, which also sets up a GPIO pin for waking up again.

edit flag offensive delete publish link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower

Stats

Asked: 2016-08-12 03:49:12 +0100

Seen: 125 times

Last updated: aug. 12 '16