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

Radio Notification Context

Hello,

I have a problem using the radio notifications. I use the softdevice V. 15.3.0.

I would like to have an interrupt every time I send an advertisement, which I can achieve using:

ble_radio_notification_init( 2, NRF_RADIO_NOTIFICATION_DISTANCE_800US, interrupt_func)

While this is working fine on its own, the interrupt is not only triggered by advertisements, but also from radio activities coming from a scanner which is running simultaneously. Is there a way to find out if the interrupt was triggered by advertisement or the scanner? Also if I could just get an interrupt when advertising this would be fine.

Best Regards,

Lukas

Edit: Wrong naming, mistaken advertisement and notification.

Parents
  • Hi.

    The function that you're referring to is apart of the radio notifications API, which will notify the application every time the radio is in use. The S112 softdevice will produce a BLE_GATTS_EVT_HVN_TX_COMPLETE event every time a BLE notification is sent. You can implement the event in the switch case in the gatt handler in your project.

     
    best regards
    Jared 
  • Hey,

    Thanks for your help. Since I know it should work for S132 I tried but could not make it work.

    I initialize the following modules

    void init(void)
    	nrf_pwr_mgmt_init();
    	ble_stack_init();
    	gap_params_init();
    	nrf_ble_gatt_init(&m_gatt, NULL);
    	advertising_init();
    	scan_init();
    }

    The ble_evt_handler looks as follows


    void ble_evt_handler(ble_evt_t const* p_ble_evt, void* p_context)
    {
    	NRF_LOG_INFO("%d", p_ble_evt->header.evt_id);
    	NRF_LOG_PROCESS();
    }

    When I run it I can see the advertisements are sent using my phone, also I get only 29 in the logs which corresponds to the scan report. Unfortunately I do not get any other evt_ids in the handler, e.g. BLE_GATTS_EVT_HVN_TX_COMPLETE does not appear.

    I was trying to follow the example: ble_peripheral/experimental/ble_app_hids_keyboard_pairing_nfc, where BLE_GATTS_EVT_HVN_TX_COMPLETE is used.

    best regards,

    Lukas

Reply
  • Hey,

    Thanks for your help. Since I know it should work for S132 I tried but could not make it work.

    I initialize the following modules

    void init(void)
    	nrf_pwr_mgmt_init();
    	ble_stack_init();
    	gap_params_init();
    	nrf_ble_gatt_init(&m_gatt, NULL);
    	advertising_init();
    	scan_init();
    }

    The ble_evt_handler looks as follows


    void ble_evt_handler(ble_evt_t const* p_ble_evt, void* p_context)
    {
    	NRF_LOG_INFO("%d", p_ble_evt->header.evt_id);
    	NRF_LOG_PROCESS();
    }

    When I run it I can see the advertisements are sent using my phone, also I get only 29 in the logs which corresponds to the scan report. Unfortunately I do not get any other evt_ids in the handler, e.g. BLE_GATTS_EVT_HVN_TX_COMPLETE does not appear.

    I was trying to follow the example: ble_peripheral/experimental/ble_app_hids_keyboard_pairing_nfc, where BLE_GATTS_EVT_HVN_TX_COMPLETE is used.

    best regards,

    Lukas

Children
Related