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

Can BLE and SoC events cause SD_EVT_IRQn simultaneously?

Hello everybody,

In the SD_EVT_IRQn ISR I check for BLE and SoC events and set flags for each so my application can fetch and dispatch the events in the main context.

Because SD_EVT_IRQn can be caused by both SoC and BLE events, I use the code in the ISR to determine which flag to set. Here's a sanitized version:

void SD_EVT_IRQHandler( void )
{                                                                                                                               
    uint16_t dummy;                                                                                                            
    // Null pointer lets us take a peek and get the return code                                                                 
    uint32_t rc = sd_ble_evt_get(NULL, &dummy);                                                                                

    // If it's not a BLE event, it must be a SoC event                                                                     
    if (NRF_ERROR_NOT_FOUND == rc)                                                                                              
    {                                                                                                                           
        signal_raise(SIGNAL_NRF_SOC_EVENT);                                                                            
    }                                                                                                                           
    else                                                                                                                        
    {                                                                                                                           
        signal_raise(SIGNAL_NRF_BLE_EVENT);                                                                           
    }                                                                                                                           
}

I'm uneasy about this code since it's only capable of catching either a SoC or a BLE event, but not both if they happen to occur "simultaneously". I can't find documentation if it's possible to enter the ISR only once, but have both a SoC and a BLE event pending. I would hope that the ISR runs twice, once for each event type, otherwise I risk missing events.

Just a comment for Nordic developers: It's a bit of a pain sharing the same IRQ for both SoC and BLE events. I understand that the IVT is limited in size, so that may not be possible. However, my world would be much nicer if functions like sd_is_ble_event_pending() and sd_is_nrf_event_pending() existed.

Can anybody with knowledge of the S110's inner-workings put my mind at ease?

Thank you!

Related