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

BLE Switching between beacon and UART



Hi ,I'm using nRF52832 Bluetooth DK and (SDK15.3.0) , I am trying to switch between beacon mode and uart mode without the need to reset button ,
e.g with reset button from p0.21:I tried changing the mode if reset source from button reset p0.21 then go to the uart , if reset from soft reset go to beacon how i do that from a simple button in other gpio ?

 

    if (NRF_POWER->RESETREAS & 0x00000004)
      ......
 
    ble_stack_init2();
    advertising_init2();
    NRF_LOG_INFO("Beacon example started.");
    advertising_start2();
    for (;; )
    {
        idle_state_handle();
    }    
}

            else {

    log_init();
    timers_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    // Start execution.
    //printf("\r\nUART started.\r\n");
   // NRF_LOG_INFO("Debug logging for UART over RTT started.");
    advertising_start();

    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }


How should I do?. Thanks in advance .

Related