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

how to turn off and on BLE service dynamically

My application uses a NRF52 (SD132, SDK 15.0.0), very simple circuit and needs to be extremely low current consumption. I measured the current in conditions of BLE on and BLE off. To turn on BLE, I use the following code:

ble_stack_init();
gap_params_init();
gatt_init();
services_init();
advertising_init();
conn_params_init();
advertising_start(erase_bonds);

The current is about 0.6mA. Without the code above, my application is still working (no bluetooth connection of course), and the current drops to 6uA.

My intention is: to turn on BLE when hard button is pressed and turn it off when transmission is finished. My question is: how do I turn off and then turn on BLE dynamically, without reset the whole environment. I guess turning on seems easy, using the code above. But turning off and remaining CPU running? How do I do that?

Thanks a lot. Dimtai 10/29/2018

Parents
  • Hi,

    If I understand you correctly, then you are saying that if you comment out: 
    // advertising_start(erase_bonds);

    Then the current consumption is about 4uA, that should be the case. Otherwise I suspect you have some peripherals enabled or logging enabled in some way.

    The current consumption when you advertise depends on the advertisement interval and you can try to get some current consumption estimations here:
    https://devzone.nordicsemi.com/power/ 

    It is of course possible to disable the softdevice, but it should not be necessary. Instead you simply stop advertising or disconnect the link when you have transferred whatever you wanted to transfer.

    Best regards,
    Kenneth

Reply
  • Hi,

    If I understand you correctly, then you are saying that if you comment out: 
    // advertising_start(erase_bonds);

    Then the current consumption is about 4uA, that should be the case. Otherwise I suspect you have some peripherals enabled or logging enabled in some way.

    The current consumption when you advertise depends on the advertisement interval and you can try to get some current consumption estimations here:
    https://devzone.nordicsemi.com/power/ 

    It is of course possible to disable the softdevice, but it should not be necessary. Instead you simply stop advertising or disconnect the link when you have transferred whatever you wanted to transfer.

    Best regards,
    Kenneth

Children
Related