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

BSP indication state setup

Hello Nordic Team,

i use SDK 12.3 and SoftDevice S130.

In the template project (\examples\ble_peripheral\ble_app_template ), the BSP module is used to indicate advertising and connection as described in the table of BSP indication states.

In the ble blinky example (\examples\ble_peripheral\experimental_ble_app_blinky), advertising and Connection is indicated using two different leds. I want the indication of advertising  and connection to be in the same way as in the template project, but struggle with it. Based on the template project i made the following changes on the blinky example:
in on_ble_Event():

static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t err_code;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
            NRF_LOG_INFO("Connected\r\n");
            //bsp_board_led_on(CONNECTED_LED_PIN);  //changed here
            //bsp_board_led_off(ADVERTISING_LED_PIN);
            err_code = bsp_indiation_set(BSP_INDICATE_CONNECTED); //changed here
            m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;

            err_code = app_button_enable();
            APP_ERROR_CHECK(err_code);
            break; // BLE_GAP_EVT_CONNECTED

        case BLE_GAP_EVT_DISCONNECTED:
            NRF_LOG_INFO("Disconnected\r\n");
            //bsp_board_led_off(CONNECTED_LED_PIN); //changed here
            err_code = bsp_indiation_set(BSP_INDICATE_IDLE); // changed here
            m_conn_handle = BLE_CONN_HANDLE_INVALID;

            err_code = app_button_disable();
            APP_ERROR_CHECK(err_code);

            advertising_start();
            break; // BLE_GAP_EVT_DISCONNECTED
            ...

and in advertising_start():

static void advertising_start(void)
{
    ...
    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING); //changed here
    APP_ERROR_CHECK(err_code);
    err_code = sd_ble_gap_adv_start(&adv_params);
    APP_ERROR_CHECK(err_code);
    //bsp_board_led_on(ADVERTISING_LED_PIN);
}

With this, advertising and connection still works but the states are not indicated via the leds. All leds are off. I think i need to initialise the bsp module somehow and  tried different Settings with bsp_init but it didn't work.

So in short, my objective is:

  • indicate advertising with a blinking led
  • indicate Connection with the same lit led
  • behaviour of the Buttons should stay the same. I do not want to use the BSP BLE Button Assignments (as far as i understand them)
  • I am not fixed to the BSP module. A simple timer to blink the led would be sufficient, but somehow i couldn't realize it so far.

Kind regards and thanks in advance

Parents Reply Children
No Data
Related