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

Change the priority of the Softdevice

Hi Nordic,

I am trying to do a time critical data acquisition in a BLE based application. 

Earlier I was using software timers. But, since the software timers are not accurate, I was not able to capture all the samples.

Thus I tried the hardware timers. But still, I am not able to capture all the data completely. In the forum , it was stated that Timer 0/1/2 are dedicated for softdevice/software timer and RTC respectively. Thus I tried with Timer 3/4, but I got the same result. Since timer 0/1/2 have other dependencies, timer 3/4 should be compartively more accurate than the other. However I did not see any difference. Can you explain the reason for this....

In one of the questions in forum, it was stated that the timers when used with softdevice are not accurate, as the softdevice has higher priority than timer, thus cpu misses the timer ticks. If so is there any way to change the priority of the softdevice, so as increase the priority of the timer, as it is important for me to capture the data completely, in accordance with the timer.

Thanks :-)

Parents
  • Hi,

    You cannot change the priority levels used by the softdevice. Here is some information about what levels are being used: S132 Interrupt priority levels

    Yes, certain timers and other peripherals are blocked or restricted by the Softdevice, but not all of those you mention. As you can see here, only TIMER0 and RTC0 are blocked by the Softdevice. The app timer library uses RTC1, but you don't need to use this library. Anyway, TIMER1, 2, 3, and 4, as well as RTC2 (and 1 if you don't use the timer library) are available for your application. 

    The accuracy of the TIMER and RTC peripheral depends on your clock source. Please refer to the product specification. 

    Since the Softdevice needs the highest priority to maintain a stable BLE link, it is not straightforward to do other tasks at strict intervals. However, you can use what we call the Timeslot API to guarantee time slots for your application. The API enables you to for example do periodic ADC sampling at strict intervals, or to run other radio protocols concurrently with the Softdevice. 

Reply
  • Hi,

    You cannot change the priority levels used by the softdevice. Here is some information about what levels are being used: S132 Interrupt priority levels

    Yes, certain timers and other peripherals are blocked or restricted by the Softdevice, but not all of those you mention. As you can see here, only TIMER0 and RTC0 are blocked by the Softdevice. The app timer library uses RTC1, but you don't need to use this library. Anyway, TIMER1, 2, 3, and 4, as well as RTC2 (and 1 if you don't use the timer library) are available for your application. 

    The accuracy of the TIMER and RTC peripheral depends on your clock source. Please refer to the product specification. 

    Since the Softdevice needs the highest priority to maintain a stable BLE link, it is not straightforward to do other tasks at strict intervals. However, you can use what we call the Timeslot API to guarantee time slots for your application. The API enables you to for example do periodic ADC sampling at strict intervals, or to run other radio protocols concurrently with the Softdevice. 

Children
Related