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

Radio Notification Problem

I think I am having a problem with Radio Notification.  I am not sure. I have an application where I need simultaneous “Central and Peripheral”.  Device only needs to advertise and listen, it never connects.  I started with “ble_app_hrs_rscs_relay” and modified “scan_evt_handler” so that it does not connect.  Next, I modified .interval to 10 ms and .window to 30 ms.  This give me perhaps good listening and as far as I can see, the highest yield of packets that are transmitted over the air.  (I’m open to suggestions is there is a better way there.)

Now I need reliable “Radio Notification” of when packets are transmitted.  I have carefully followed everything I can find and I’ve incorporated “ble_radio_notification.c” and “ble_radio_notification.h”.  The “ble_radio_notification_init” function is called in “main” directly after “ble_stack_init”.  I even tried to get closer to the “sd_softdevice_init” by going deeper in the code, but nothing changed.  I noticed one thing that changed in Nordic’s “Radio_Notification” examples.  In early versions of “ble_radio_notification_init” function, NRF_RADIO_NOTIFICATION_TYPE_INT_ON_X was a one of the parameters.  I’ve noticed that it is no longer a changeable parameter at the function call for “ble_radio_notification_init”.  I’ve gone into the function to change the “sd_radio_notification_config_set” NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE and I see strange things.  I see a periodic interrupt every 10 ms.  That 10 ms corresponds to the 10 ms in the scan .interval.  If I change the .interval to 20 ms is the interrupt changes to 20 ms.

I understand that Radio Notification does multiple things.  How do I get a valid notification on INACTIVE (or ACTIVE) ONLY?

This testing is done on the NRF52840 DK.  Using SES environment and "ble_app_hrs_rscs_relay".

   

Parents
  • Hello,

    I'm not sure why the notification type option was removed from the library. I assume it must have been done to simplify the API a bit. However, the SD function to enable radio notifications should pretty straight forward to use directly without the library, so I would suggest doing that instead.

    Eg., something like this:

    void RADIO_NOTIFICATION_IRQHandler()
    { 
        // radio notification ISR
    }
    
    void radio_notification_enable()
    {
        uint32_t  err_code;
    
        err_code = sd_nvic_ClearPendingIRQ(RADIO_NOTIFICATION_IRQn);
        APP_ERROR_CHECK(err_code);
        
        /* Interrupt priority is set to 6 by the Softdevice */
        err_code = sd_nvic_EnableIRQ(RADIO_NOTIFICATION_IRQn);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, 
                                                 NRF_RADIO_NOTIFICATION_DISTANCE_NONE);
        APP_ERROR_CHECK(err_code);
    }

    That 10 ms corresponds to the 10 ms in the scan .interval.  If I change the .interval to 20 ms is the interrupt changes to 20 ms.

    I suspect the reason you are only getting radio notifications for the scan events and not the advertisement events may be that there is too little time between the events. Here is an excerpt from the Softdevice specification stating that notifications may be dropped if the distance is to short (link):

    When there is sufficient time between Radio Events (tgap > tndist), both the ACTIVE and nACTIVE notification signals will be present at each Radio Event. Two radio events with ACTIVE and nACTIVE signals illustrates an example of this scenario with two Radio Events.

    Only enabling the nACTIVE signal or reducing tprep should increase the chance of getting a notification signal for every radio event.

Reply
  • Hello,

    I'm not sure why the notification type option was removed from the library. I assume it must have been done to simplify the API a bit. However, the SD function to enable radio notifications should pretty straight forward to use directly without the library, so I would suggest doing that instead.

    Eg., something like this:

    void RADIO_NOTIFICATION_IRQHandler()
    { 
        // radio notification ISR
    }
    
    void radio_notification_enable()
    {
        uint32_t  err_code;
    
        err_code = sd_nvic_ClearPendingIRQ(RADIO_NOTIFICATION_IRQn);
        APP_ERROR_CHECK(err_code);
        
        /* Interrupt priority is set to 6 by the Softdevice */
        err_code = sd_nvic_EnableIRQ(RADIO_NOTIFICATION_IRQn);
        APP_ERROR_CHECK(err_code);
    
        err_code = sd_radio_notification_cfg_set(NRF_RADIO_NOTIFICATION_TYPE_INT_ON_INACTIVE, 
                                                 NRF_RADIO_NOTIFICATION_DISTANCE_NONE);
        APP_ERROR_CHECK(err_code);
    }

    That 10 ms corresponds to the 10 ms in the scan .interval.  If I change the .interval to 20 ms is the interrupt changes to 20 ms.

    I suspect the reason you are only getting radio notifications for the scan events and not the advertisement events may be that there is too little time between the events. Here is an excerpt from the Softdevice specification stating that notifications may be dropped if the distance is to short (link):

    When there is sufficient time between Radio Events (tgap > tndist), both the ACTIVE and nACTIVE notification signals will be present at each Radio Event. Two radio events with ACTIVE and nACTIVE signals illustrates an example of this scenario with two Radio Events.

    Only enabling the nACTIVE signal or reducing tprep should increase the chance of getting a notification signal for every radio event.

Children
No Data
Related