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

How to run low-latency tasks?

I need to use a nRF52 chip to handle interrupts with low (and known) latency.  Basically, there are specific ~100 us long intervals during which I need interrupt latency to be in the 1 us range.  These intervals happen on an irregular (but known in advance) schedule, ~1-200 times per second.  The interrupt handlers are very fast, also 1 us range, to reset timers and/or flip a couple of GPIO pins.  The Bluetooth radio should be able to maintain a connection; it is okay to (deliberately) drop some packets to accomplish this.  Additionally, if I know when the CPU would be needed for Bluetooth I can schedule around that.

I looked at doing something similar a few years ago on nRF51 and found there was simply no way to guarantee short latency; with a Bluetooth connection active, a task that is supposed to run every 1ms would not run for 3-6ms once in a while.

Could you please let me know how nRF52 behaves in this regard?  Is it possible to briefly reserve the CPU for user code during an active connection?  Alternately, is it possible to check with an API call when the Bluetooth stack will next need the CPU, and for how long?

Best,

Alex

Parents Reply Children
Related