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

Softdevice consumes too much time

Hello,

I am using nrf52832 with SDK12 with gcc compiler. I have extended the ble_app_template example with 2 services.

I have 1 timer interrupt using RTC(100 ms) and 1 timer interrupt using HF timer(20 micro secs). I am toggling a pin in HF timer interrupt. The low frequency timer has some functionality to send data once connected to a central BLE device. This is not important as I am facing timing issues in advertising phase.

The only issue is the amount of time taken by softdevice to execute. When I see the GPIO on a CRO, I see 4 milli seconds of interruption per advertising interval. This is a continous 4 ms zone when its supposed to be 300 micro seconds at max as specified by softdevice manual. Is it possible that softdevice can take that long amount of time? It hampers systems ability to add any real time task to system. What could be consuming so much time? I am certain the system has no other added load than described here.

As added information, I get the 4ms execution band of softdevice per 25 milliseconds when device is connected.

Kindly provide some suggestion to reduce the time consumed by softdevice.

Parents
  • I think I understand the problem now. I am reloading the NRF_TIMER2->CC[0] register every time in the interrupt handler. Basically, when there is a softdevice interruption(which is surely more than 20 micro secs), the current timer count has passed the loaded value in the compare register and hence it waits for an entire cycle(16 MHz i.e. nearly 4 ms) to interrupt again.

    Is there a way to have pre-interrupt and post-interrupt hooks for when softdevice takes control? I would like to adjust the timer count in those routines.

    I hope the explanation is clear.

Reply
  • I think I understand the problem now. I am reloading the NRF_TIMER2->CC[0] register every time in the interrupt handler. Basically, when there is a softdevice interruption(which is surely more than 20 micro secs), the current timer count has passed the loaded value in the compare register and hence it waits for an entire cycle(16 MHz i.e. nearly 4 ms) to interrupt again.

    Is there a way to have pre-interrupt and post-interrupt hooks for when softdevice takes control? I would like to adjust the timer count in those routines.

    I hope the explanation is clear.

Children
No Data
Related