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

Getting time ticks or adv packet count

Is there an internal counter for the number of packets transmitted since power on?

Im trying to change the advertising packet content after a timer is expired or a certain count, but i get invalid parameter error in advertising_init() and advertising_start() functions when i call them for the 3rd time. I think this can solve the problem about changing the packet but im trying to understand when to change it first.

What would be the preferred approach for getting the timer ticks since the board is powered on or get number of packets transmitted so far?

Im using ble_app_hrs example with nrf51-dk on sdk6.1.0 and sd 7.0.0.

Parents Reply
  • Hi,

    I attempted to replicate this, but for me it worked.

    #include "ble_radio_notification.h"
    
    #define RADIO_NOTIFICATION_IRQ_PRIORITY        1
    #define RADIO_NOTIFICATION_DISTANCE            NRF_RADIO_NOTIFICATION_DISTANCE_800US
    volatile uint32_t count = 0;
    
    void radio_notification_evt_handler(bool radio_evt)
    {
        if (radio_evt)
        {
            //radio going active
        } 
        else 
        {
            //radio inactive
            count++;
        }
    }
    

    Then watch the count variable in your IDE, for an advertising interval of 100 gave 0x54 and an interval of 1000 gave 0xC.

    Maybe your code is not in the advertising state, but is connected to something and sending two packets per second?

Children
No Data
Related