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

RADIO_IRQn can only be enabled per NVIC_EnableIRQ if Multiprotocol Support?

My application (nRF51 S130 v2.0.1 SDK12.3.0) uses the Radio Timeslot feature for multiprotocol support similarly to the example in https://github.com/NordicPlayground/nrf51-ble-micro-esb-uart.

On calling sd_nvic_SetPriority(RADIO_IRQn, RADIO_IRQ_PRIORITY); in TIMESLOT_BEGIN_IRQHandler the following error shows up:

NRF_ERROR_SOC_NVIC_INTERRUPT_NOT_AVAILABLE

Why is RADIO_IRQn not available?

  • Hi José

    When using the SoftDevice the radio interrupt is not available, whether or not you are in a timeslot. Radio interrupts will trigger the interrupt handler in the SoftDevice, and events will have to be forwarded from there. 

    When in a timeslot radio interrupts are forwarded to the application through timeslot signals, and will trigger the signal handler with the signal_type set to NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO. When this signal occurs you can handle the interrupt in a similar way, and check the various event registers to see which of the radio events triggered the interrupt. 

    if you take a look at the implementation in the nrf51-ble-micro-esb-uart example you can see that the RADIO_IRQHandler() function is called explicitly from the signal handler (line 174 of esb_timeslot.c):

    case NRF_RADIO_CALLBACK_SIGNAL_TYPE_RADIO:
       signal_callback_return_param.params.request.p_next = NULL;
       signal_callback_return_param.callback_action = NRF_RADIO_SIGNAL_CALLBACK_ACTION_NONE;
       ESB_TIMESLOT_DEBUG_PIN_SET(ESB_TIMESLOT_DBG_PIN_RADIO_IRQHANDLER);
       RADIO_IRQHandler();
       ESB_TIMESLOT_DEBUG_PIN_CLEAR(ESB_TIMESLOT_DBG_PIN_RADIO_IRQHANDLER);
       break;

    Best regards
    Torbjørn

     

  • Hi,

    RADIO_IRQn is enabled per NVIC_EnableIRQ() in the example nrf51-ble-micro-esb-uart when calling TIMESLOT_BEGIN_IRQHandler. Does this make sense according to your statement?

    On the other hand, when using the Softdevice, how can change the pririty level of the RADIO_IRQn?

    BR

  • Hi José

    You can't change the interrupt priority directly in a timeslot. All the signals will be forwarded at interrupt priority 0 (the highest). 

    If you want to run the interrupt at a lower priority I would recommend deferring execution to a lower interrupt context, either by setting a software interrupt in the signal handler, or by using something like the app_scheduler module to schedule the code to be run from the main context. 

    Best regards
    Torbjørn

  • Hi,

    RADIO_IRQn is enabled per NVIC_EnableIRQ() in the example nrf51-ble-micro-esb-uart when calling TIMESLOT_BEGIN_IRQHandler. Does this make sense according to your statement?

    Our experience says that RADIO_IRQn must be enabled per NVIC_EnableIRQ in order to get signal RADIO per callback. Can you please confirm this?

    BR

  • Hi

    It will be called implicitly through nrf_esb_init(..), that is correct, but I don't think this is strictly necessary. 

    I would have to do some testing to be sure though ;)

    Best regards
    Torbjørn

Related