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

What is maximum number of event handlers supported for radio notification event handler?

My application would like to receieve notifications at several different times before a radio notification event. Specifically the application needs to receive notification 250mS before and the flash manager requires notification 50mS before.

Does ble_radio_notification_init support multiple event handlers and if so how many?
What errors will be generated when exceeding the maximum supported event handlers?

In other words will this work:

err_code = ble_radio_notification_init(NRF_APP_PRIORITY_HIGH,
                                       NRF_RADIO_NOTIFICATION_DISTANCE_4560US,
                                       ble_flash_on_radio_active_evt);
APP_ERROR_CHECK(err_code);

err_code = ble_radio_notification_init(NRF_APP_PRIORITY_HIGH,
                                       NRF_RADIO_NOTIFICATION_DISTANCE_250MS,
                                       application_radio_active_evt);
APP_ERROR_CHECK(err_code);
  • No, you can have only one notification distance, so the above will give a notification only at the latter distance. However, there is no way to get a notification 250 milliseconds before, and the only legal values for this parameter are those distances given in nrf_soc.h:

    
    /**@brief Possible values of ::nrf_radio_notification_distance_t. */
    enum NRF_RADIO_NOTIFICATION_DISTANCES
    {
      NRF_RADIO_NOTIFICATION_DISTANCE_NONE = 0, /**< The event does not have a notification. */
      NRF_RADIO_NOTIFICATION_DISTANCE_800US,    /**< The distance from the active notification to start of radio activity. */
      NRF_RADIO_NOTIFICATION_DISTANCE_1740US,   /**< The distance from the active notification to start of radio activity. */
      NRF_RADIO_NOTIFICATION_DISTANCE_2680US,   /**< The distance from the active notification to start of radio activity. */
      NRF_RADIO_NOTIFICATION_DISTANCE_3620US,   /**< The distance from the active notification to start of radio activity. */
      NRF_RADIO_NOTIFICATION_DISTANCE_4560US,   /**< The distance from the active notification to start of radio activity. */
      NRF_RADIO_NOTIFICATION_DISTANCE_5500US    /**< The distance from the active notification to start of radio activity. */
    };
    
    

    I would also like to recommend you to upgrade to second revision chips for development, since that is the ones you'll most likely end up using in production. That will also enable you to use SDK 5.1.0/S110 version 6.0.0, which has the flash writing builtin in the softdevice.

  • Hello Ole, thanks for the response!

    I'm a bit confused by your comment about the revision 2 of the device. I am already using SDK 5.1.0 and soft device 6.0.0. I am currently designing with nrf51822 evaluation kit, with a chip labeled N51822 QFAAFA 1328AA.

    Is this chip compatible with the SDK 5.1.0 and Soft Device 6.0.0?

    Does the ble_flash module in the SDK 5.1.0 still require the radio notification event handler to be called?

    If I'm not using ble_flash module code in my application can I remove the call to ble_flash_on_radio_active_evt? I based my application off the ancs example which included ble_flash.c

    Has the ble_flash code been replaced by soft device routines?

  • With SDK 5.1.0/S110 6.0.0, ble_flash.c isn't really usable, since it manipulates the NVMC directly, without using the softdevice APIs. None of the SDK examples should be using it, and any custom application should also be modified to not use it.

    ble_flash have been superseded by integrating an API for flash operations in the softdevice (sd_flash_* functions), which is then wrapped by the SDK pstorage module. If you have further questions on this, I suggest you look at the existing questions on this on this site, and if you can't find the answers, post questions separately. The documentation for pstorage may also be helpful, and it is available here: https://devzone.nordicsemi.com/documentation/nrf51/5.1.0/html/a00131.html

Related