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

sd_app_evt_wait only waits until central is connected

Hello,

I'm trying to put a BLENano board to slepp every loop iteration. These are te steps:

  1. setup:

    sd_power_mode_set(NRF_POWER_MODE_LOWPWR);
    NRF_POWER->TASKS_LOWPWR = 0; NRF_POWER->DCDCEN = 0x00000000;

2: loop:


   [...]

   sd_app_evt_wait();

   BLECentral central = ble.central(); 

   // if a central is connected to peripheral:
   if (central) {        

        sd_app_evt_wait();

       // while the central is still connected to peripheral:
       while (central.connected()) {
              sd_app_evt_wait()
              [...]
    }

   [...]

The first time sd_app_evt_wait is called, it waits until a central is connected. But then, the execution enters the inner loop and sd_app_evt_wait returns instantly.

I've read things about pending events or interrupts, bu I've not managed to get to work. I've also tried calling sd_nvic_EnableIRQ(SWI2_IRQn); with a proper empty SWI2_IRQHandler, but then sd_app_evt_wait never returns and no central can connect to the device.

Please, ¿is there something with the library I have to setup in order for this to work?

Thanks!

Parents
  • You've pretty much gone beyond my knowledge as I've done most of my work using Nordic as a Peripheral device and not a central. That said, if my Googling is any good, that CAN1 SCE maps to IRQ number 22 which is SWI2 on the nRF. SWI2 is used by the soft device for protocol and SoC events. My guess is that the stack wants you to do something to respond to an event which would clear the IRQ, you can try clearing it but I don't know what affect that may have on stack operation if any.

Reply
  • You've pretty much gone beyond my knowledge as I've done most of my work using Nordic as a Peripheral device and not a central. That said, if my Googling is any good, that CAN1 SCE maps to IRQ number 22 which is SWI2 on the nRF. SWI2 is used by the soft device for protocol and SoC events. My guess is that the stack wants you to do something to respond to an event which would clear the IRQ, you can try clearing it but I don't know what affect that may have on stack operation if any.

Children
No Data
Related