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

Supporting a real-time task

My 51822 needs to support some realtime control code that runs for about 75mS. During that time I need to mask all interrupts. With a logic analyzer I can see that my realtime code is getting interrupted every 25mS or so, I guess by the SoftDevice. I tried using CRITICAL_REGION_ENTER/CRITICAL_REGION_EXIT but that does not mask the interrupts.

  1. How can I mask interrupts so that my realtme code will not be interrupted no matter what the radio is doing?
  2. Is there a way to do this such that I don't unduly disturb the SoftDevice?

Regards, Bret

Parents
  • Hi Bret,

    to answer your questions

    1) How can I mask interrupts so that my realtme code will not be interrupted no matter what the radio is doing? You can't. The radio will always have highest priority. While in a connection or advertising, there will be non-maskable radio interrupts. 2) Is there a way to do this such that I don't unduly disturb the SoftDevice? It's possible to adjust the connection parameters such that there is enough time between radio interrupts for you to perform the real-time tasks. By adjusting the connection interval and slave latency parameters, it's possible to synchronize your tasks with the radio. For example, using 7.5 ms connection interval and 20 slave latency there will be 7.5 * 20 ms between each radio interrupt when you are not actively sending any data.Similarly you can adjust the advertising interval if your real-time task has to be performed while advertising.

    The CRITICAL_REGION_ENTER/EXIT macros are used to protect your code from other parts of your code. It masks every interrupt except the radio interrupt.

  • No problem :)

    The RADIO_NOTIFICATION_IRQn is a pure software triggered NVIC interrupt. No need to clear any peripheral registers, and NVIC automatically clears the interrupt flag in the CPU.

Reply Children
No Data
Related