Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How can I use the NRF51 SDK-12.3 nrf_pwr_mgmt example with the BLE stack?

Hi.

We are developing with the nRF51 series and creating data loggers of various types. We would like to combine features of the nrf_pwr_mgmt example with firmware that uses UART and the BLE stack. We don't know how to get the chip to sleep either with or without System_Off (tried several things without success). It seems like the BLE stack is already sleeping between advertisements, but we would like to go into System_Off after initial configuration to shelve the part until shipping, and enable a single push button interrupt to restore the running/configured state. Please outline how one would convert the BLE-UART example of SDK-12.3 to one with power management, and using only a single button.

Developing with Keil uVision V5.3.0 on the nRF51 DK board PCA10028.

Thanks!

Steve

  • Hi Steve,

    Some of our experts are out of office until Tuesday because of public holidays in Norway. We will come back to you next week.

    Best regards,

    Marte

  • Hi Steve,

    Please try the example below. I started with the original ble_app_uart example in SDK 12.3.0 and added the power managment library to it like how it was done in the nrf_pwr_mgmt example, and it seems to work. But I have not fully tested it.  If you have any further questions, please let me know.

    Cheers

    Vidar

    7762.ble_app_uart.zip

    Update 5/20 - demo example with app scheduler:

    ble_app_uart_pwr_mgmt.zip

  • Vidar,

    I am confused about some things with these newest changes. We now have two different methods for going to sleep.

    1. The function on_adv_evt() calls sleep_mode_enter() on an ADV_EVT_IDLE, and sleep_mode_enter() calls sd_power_system_off() which is not supposed to return until a reset, but my suspicion is that sd_power_system_off() is not non-functional -- because of the nrf_pwr_mgmt module?
    2. The bsp_event_handler() now calls nrf_pwr_mgmt_shutdown(...SYSOFF) instead of sleep_mode_enter().

    Am I correct in believing that the nrf's shutdown method is now the only effective method for SYSOFF functionality? If so, why is sd_power_system_off() still called for advertize idle?

    Steve

  • Steve,

    1. Both methods end up calling sd_power_system_off() in the end. The difference is that the power management module provides the shutdown callback and a Shutdown retry mechanism (link) you can enable through sdk_config.h.

    2. It was not necessary to replace the sleep_mode_enter()  call in bsp_event_handler(), but I assumed the goal was to integrate the power management module with the example, so that's why I did it. I should probably have replaced the other calls to sleep_mode_enter() to make this clearer.

    Vidar

    edit: added missing link to documentation.

Related