This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Radio notification only after BLE radio

I'd like to get a notification every time after the radio has been active (as shown as NACTIVE in the S110 rev 1.3 spec). How can I make this mappen?

I see two functions available: sd_radio_notification_cfg_set and ble_radio_notification_init. Are these two functions supposed to work together or should we only use the ble_radio_notification_init? This does not have configuration of the notification events, only the distance to next active radio period...

  • Like this:

    bool current_radio_active_state = false;
    
    void ble_on_radio_active_evt(bool radio_active)
    {
        current_radio_active_state = radio_active;
    }
    
    static void radio_notification_init(void)
    {
        uint32_t err_code;
    
        err_code = ble_radio_notification_init(NRF_APP_PRIORITY_LOW,
                                               NRF_RADIO_NOTIFICATION_DISTANCE_800US,
                                               ble_on_radio_active_evt);
        APP_ERROR_CHECK(err_code);
    }
    
    
    int main(void)
    {
    ...
        radio_notification_init();
    ...
    }
    
  • So, just asking for clarification. If I use this example to set ble_radio_notification_init in conjunction with sd_radio_notification_cfg and set the TYPE to NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, it will ignore the distance setting and provide a radio notification on inactive?

  • You can just use standard ble_radio_notification_init function, that already calling sd_radio_notification_cfg inside, it will generate interrupts on both inactive to active and active to inactive events and you can determine the event type with radio_active value in ble_on_radio_active_evt handler.

    UPD:

    NRF_RADIO_NOTIFICATION_DISTANCE_NONE can only be used when the event does not have a notification. NRF_RADIO_NOTIFICATION_DISTANCE parameter is only distance before radio activity and there shoudn't be delay with interrupt after radio activity. Here is written: "The distance from the active notification to start of radio activity."

    I have done some more debug'ing here, and the radio_active flag seems to be true if one has a connection active. Hence, there is no way to determine if the interrupt happens before or after the radio transmission.

    Why? When ble_on_radio_active_evt handler will be called with (radio_active == true) it means that now after NRF_RADIO_NOTIFICATION_DISTANCE_XXX time will be radio activity. If ble_on_radio_active_evt handler will be called with (radio_active == false) it means that radio activity ended and now radio is inactive.

  • I have done some more debug'ing here, and the radio_active flag seems to be true if one has a connection active. Hence, there is no way to determine if the interrupt happens before or after the radio transmission. In addition, I tried using NRF_RADIO_NOTIFICATION_DISTANCE_NONE as (they way I see it) this would only happen after a radio transmission. However, by using this I get a parameter error in return.

  • When I use this code with SDK 7.1, I get this warning:" warning: implicit declaration of function 'ble_radio_notification_init' 'is invalid in C99". I don't get compilation errors, but I cannot build the project. Why could this be?

Related