This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How do I run a long operation without disrupting a BLE link?

I am developing a BLE peripheral with SDK9 and SD110. The PPCP are 80-400ms, 5 slave latency and 5s supervision timeout.

I am currently running some blocking code in response to an alert level update (from IAS). The blocking code is manually driving a piezo element. I am placing that function on the scheduler queue in the hopes it would be pre-empted by the softdevice as needed. Unfortunately I am getting link loss as a result of updating the alert level.

Is there a way to make this work with my current setup? Or, do I need to use a different method? (At this time it seems like a timer would be an acceptable alternative, but I'm pressed for time and have not worked with 16MHz timers on this device yet)


EDIT

Thanks all -- I ended up using TIMER1 and some clever code. Things now work acceptably. Previously I am fairly certain my code was executing in too high of an interrupt context. Now I don't care what the context is because the code returns nearly immediately.

  • The softdevice will interrupt you any time it needs to, so the length of your operation isn't likely to be a problem. Getting a nice buzz may be as you'll get interrupted all the time and have weird glitches.

    So if you are 'getting link loss' it's more likely you're doing something else which is causing an error or hardfault in some other piece of code. So I'd go looking there.

  • FormerMember
    0 FormerMember

    When using the softdevice, the softdevice has the highest interrupt priority. Therefore, driving a piezo element will not block the softdevice. The Exception (interrupt) management with a SoftDevice chapter in the S130 softdevice specification shows the interrupt priorities used by the softdevice, and which interrupt priorities the application should use.

Related