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

Advertising restart after a disconnect event

Hi!

Using SDK 14, I am advertising and see my device on the phone with nRFConnect. The indication LED flashes (indication) properly and in fixed intervals. When I connect with my phone the LED lights up without flashing as expected. After I disconnect the device wont advertise anymore and the LED doesn't flash anymore. I can also not find the device with my phone.

I tried to put a advertising_start(false); in the disconnected event:

case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO("Disconnected, reason %d\r\n",
                          p_ble_evt->evt.gap_evt.params.disconnected.reason);
            m_conn_handle = BLE_CONN_HANDLE_INVALID;
            advertising_start(false);
            break; // BLE_GAP_EVT_DISCONNECTED

This makes the LED flash again as if it was advertising but I can't find the device with my phone. Very sad. The boolean false just states that no bonds should be erased (I took this one from the examples)

So two questions:

  • How do I make this work (that I can connect and advertise over and over again)?
  • Sometimes after just some seconds the LED will light up as if it's in connected state. I cannot figure why ...

I would be very glad if someone could give me some advice ...

Best Noah

Parents
  • Hi Joakim

    I am using a custom board. But that does not have any impact. As the LED just works fine :) (I adjusted the BSP variables) I used the BAS example and ported it from SDK 12 to SDK 14 (as I already started the project in SDK 12 and then decided to switch to 14 (which was a huge mistake due to various reasons (Mesh being one))). Of course I had a look for different changes and I checked the few I had (I did a git bisect) but I am afraid it's a problem from after the SDK 14 port. So I am not sure if I missed something or if it's a bug in the SDK 14. The question is: do I have to restart advertising on my own? Because I was kind of 100% sure I didn't with SDK 12. If so, why doesn't an advertising_start() work?

Reply
  • Hi Joakim

    I am using a custom board. But that does not have any impact. As the LED just works fine :) (I adjusted the BSP variables) I used the BAS example and ported it from SDK 12 to SDK 14 (as I already started the project in SDK 12 and then decided to switch to 14 (which was a huge mistake due to various reasons (Mesh being one))). Of course I had a look for different changes and I checked the few I had (I did a git bisect) but I am afraid it's a problem from after the SDK 14 port. So I am not sure if I missed something or if it's a bug in the SDK 14. The question is: do I have to restart advertising on my own? Because I was kind of 100% sure I didn't with SDK 12. If so, why doesn't an advertising_start() work?

Children
No Data
Related