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

How to restart ble when it is connect on nrfconnect app on mobile without reaching the breakpoint?

Hi Everyone ,

I have setup an gpiote iinterrupt on a button on a custom PCB incorporating nrf52840.
Whenever the interrupt arrives(button pressed) the bluetooth shall wake up from its sleep(start advertising again).

i am able to do this but partially.
When the nrf52840 ble is not connected with android app(nrfconnect) , the ble wakes up fine without any errors.

But in the scenario where ble of nrf52840 is connected with the nrfconnect app and button is pressed, The code reaches a breakpoint resulting is restart of the board after sometime.
Here's the code inside the interrupt handler.

void
in_pin_handler (nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{

sd_ble_gap_adv_stop (NULL);

advertising_start ();

}

void advertising_start(void)
{
uint32_t err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
}

Parents Reply Children
No Data
Related