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

How to restart advertising on a custom button on nrf52840?

Hi Everyone

I am using 

SDK 15.0 

Segger Embedded Studio

nrf52840 on a custom PCB.

Softdevice s140.

FreeRTOS.

My requirement is , on the press of a button , the advertising should restart.

This is what i have done : 

1. Detect button press.

2. Stop the Advertsing using sd_ble_gap_adv_stop() function.

3. Start the advertising.

By default the BLE will advertise for 2 minutes and then stop and then i will press the button , it starts advertising again. 

This procedure works fine , if the BLE is not connected to the phone Nordic App.

However, If the phone Bluetooth is connected to the Board via the Nordic App and Button is pressed. The System goes into a breakpoint condition.

What is the correct procedure to finish this requirement?

Pardon me , if any information is required.

Thanks

Rajat

Related