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

High priority repetitive task

Hi everyone,

My configuration:

  • nrf52832 microcontroller
  • Softdevice S132 V4.0.2
  • Nordic SDK 13.0

I need to develop a repetitive task with 10 Hz frequency. This task contains only algorithms and it doesn't involve the use of any peripherals.

This task has to be executed always and it must never be interrupted.

What is the best solution to do this? RTC, Timer, Timeslot, ...? Which mechanism give me the certainty of precise and uninterrupted task execution?

Thanks

Parents
  • Hi

    Unfortunately there is no way to guarantee un-interrupted access to the CPU at a specific point in time when the SoftDevice is running.

    The SoftDevice has exclusive access to the highest priority interrupts (0 and 1), and when the link layer in the SoftDevice is doing something critical (like processing an incoming packet) it will block everything else for a couple of hundred microseconds.

    The RTC and TIMER modules can run in the background and generate events at a consistent rate, but you won't be able to process the events if the SoftDevice is busy. The timeslot API can give you a period during which you won't be interrupted, but you won't be able to start a timeslot if the SoftDevice has scheduled a higher priority activity at the same time.

    If it is enough that you can guarantee that the code will be executed within a certain amount of time, but you can accept some variation within those limits, then you should be able to find a solution.

    Best regards
    Torbjørn Øvrebekk

Reply
  • Hi

    Unfortunately there is no way to guarantee un-interrupted access to the CPU at a specific point in time when the SoftDevice is running.

    The SoftDevice has exclusive access to the highest priority interrupts (0 and 1), and when the link layer in the SoftDevice is doing something critical (like processing an incoming packet) it will block everything else for a couple of hundred microseconds.

    The RTC and TIMER modules can run in the background and generate events at a consistent rate, but you won't be able to process the events if the SoftDevice is busy. The timeslot API can give you a period during which you won't be interrupted, but you won't be able to start a timeslot if the SoftDevice has scheduled a higher priority activity at the same time.

    If it is enough that you can guarantee that the code will be executed within a certain amount of time, but you can accept some variation within those limits, then you should be able to find a solution.

    Best regards
    Torbjørn Øvrebekk

Children
Related