Hey
I'm using the softdevice s140 in my project (and the latest SDK 17.x).
I successfully enable the softdevice and am able to start an advertising (as peripheral). However when I try to connect to it via a central device the connection times out. When I debug I see that the SWI2 is triggered (I've added a default irg handler), but my BLE-Event handler which I registered like this:
NRF_SDH_BLE_OBSERVER(m_ble_observer, BLE_OBSERVER_PRIO, vHandleBleEvent, NULL);
gets never called.
Now my questions:
- Why is SWI triggered?
- How can I get the SD to trigger the registered BLE event handler (vHandleBleEvent) ?
Any help would be much appreciated.
Cheers
David
UPDATE:
I've had a look at the SD_EVT_IRQHandler defined in nrf_sdh.c and implemented my own IRQ handler for SWI2 where I call the same function, which is called in SD_EVT_IRQHandler.
void vSwi2IRQHandler(void)
{
nrf_sdh_evts_poll();
}
Now I receive BLE events via the registered ble-event handler, which is great, because now I can establish a BLE connection.
So this issue is more or less solved, however I still am wondering, if there is something wrong with my code.
This question remains: Is it OK to define my own irq handler for SWI2 and poll for events there? Is it safe, or could it lead to unexpected behavior?