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 .

Parents
  • Hi

    I am struggling to understand what exactly you want. Do you want to switch between UART and Beacon advertising without resetting? In that case, take a look at the ble_app_uart example, and try modifying it to act as a beacon instead of a connectable Bluetooth peripheral. 

    If you want to change between these two peripherals using a button, that shouldn't be so hard implementing into the ble_app_uart example either.

    If you want to set the reset button as another button on your DK, that is not possible.

    Best regards,

    Simon

  • Thank you Simon,i tried ... can you give me a simple example that explain the steps how to transform from mode beacon to connected mode  without any problem ? , What is the  function should be stopped ? What is the function should be activated?

Reply Children
No Data
Related