This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

If Bluetooth is turned off, the mobile phone cannot find it when it is turned on later

Hello Nordic engineer,

SDK is 15.3.0, and example is ble_app_uart

I use the "nrf_sdh_disable_request()" function to turn off Bluetooth

Then start with the function "nrf_sdh_enable_request()"

The mobile phone cannot find Bluetooth

After turning bluetooth back on, do I have to turn on something to make bluetooth work?

Thanks

Parents
  • Hi,

    Your mobile phone (or any other device) can only see the nRF when it is advertising. I do not know much about your code, but I assume you do not start advertising (for instance by calling ble_advertising_start()) after re-enabling the SoftDevice using nrf_sdh_enable_request().

    (As a side note, most applications never need to disable the SoftDevice so unless there is a good reason for your orginal call to nrf_sdh_disable_request(), you should consider removing that as well. If the point is just to "turn off Bluetooth", then you can simply stop advertising and/or scanning and disconnect any connections until you want to "turn on Bluetooth" again.)

  • Hi, Nordic engineer,

    Thank you for your reply,

    Regarding "advertising", I try to add "ble_advertising_start()"

    About your second paragraph

    (As a side note, 
    most applications never need to disable the SoftDevice so unless there is a good reason for your orginal call to nrf_sdh_disable_request(),
    you should consider removing that as well. 
    If the point is just to "turn off Bluetooth",
    then you can simply stop advertising and/or scanning and disconnect any connections until you want to "turn on Bluetooth"

    For example "ble_app_uart"

    It should only have "advertising" and not "scanning", right?

    If I stop advertising, will it not occupy the timeslot?

    I use BLE+ESB, but the synchronization is not good

    So I want to try to turn off bluetooth, because only 1 device in my usage scenario needs to be paired with the phone,

    the rest can be turned off

    Thank you

Reply
  • Hi, Nordic engineer,

    Thank you for your reply,

    Regarding "advertising", I try to add "ble_advertising_start()"

    About your second paragraph

    (As a side note, 
    most applications never need to disable the SoftDevice so unless there is a good reason for your orginal call to nrf_sdh_disable_request(),
    you should consider removing that as well. 
    If the point is just to "turn off Bluetooth",
    then you can simply stop advertising and/or scanning and disconnect any connections until you want to "turn on Bluetooth"

    For example "ble_app_uart"

    It should only have "advertising" and not "scanning", right?

    If I stop advertising, will it not occupy the timeslot?

    I use BLE+ESB, but the synchronization is not good

    So I want to try to turn off bluetooth, because only 1 device in my usage scenario needs to be paired with the phone,

    the rest can be turned off

    Thank you

Children
  • eric_cheng said:

    For example "ble_app_uart"

    It should only have "advertising" and not "scanning", right?

    Yes. The point is that to "disable Bluetooth" you stop doing bluetooth activities. And that is typically scanning, advertising or being in a connection. For a pure peripheral, scanning is never relevant. And for a pure central, advertising is never relevant. The key is to stop doing what you no longer want to to Slight smile

    eric_cheng said:

    If I stop advertising, will it not occupy the timeslot?

    I use BLE+ESB, but the synchronization is not good

    If you stop advertising, the SoftDevice will not schedule time for advertising, no. So you will get allocated more time from the radio timeslot API. But of course skipping it altogether is simpler, as you can if you only use ESB while the SoftDevice is disabled. I do not know the details about your product, but it could be that you have a use case where disabling the SoftDevice makes sense.

    eric_cheng said:
    So I want to try to turn off bluetooth, because only 1 device in my usage scenario needs to be paired with the phone,

    I did not get that? If you only want to prevent others from connection, you can stop advertising. Or if you only want the bonded device to be allowed to connect you can use whitelisting. (not sure if that is the point with the above sentence, though).

Related