Can particle system firmware stop the user firmware to run?

I have experienced an issue where my user firmware has missed the detection of a falling edge on a digital signal pin. I am guessing this could only happen if the particle system firmware took over and stopped user firmware. Can someone please advise if this is a possibility? How can I prevent this from happening again?

You probably need to use interrupts instead of checking in user firmware if you need to reliably detect the edge signal:

https://docs.particle.io/reference/device-os/firmware/argon/#attachinterrupt-

2 Likes

Nope, your own code might cause the same behaviour.
As Kenneth already said, this is where interrupts are your best bet.

2 Likes

Are you suggesting, the user code runs in the background, even when particle is going through, cellular reconnection, updates, etc?

Again, nope, I was not actually suggesting that, but with SYSTEM_THREAD(ENABLED) it can be the case :wink:

What I rather was trying to get across is that while it could be the system firmware that causes your code to miss a pin change, so can your application firmware, hence the word “only” is limiting the potential causes in a misleading manner.

BTW, you didn’t state any of the edge cases like (re)connect or OTA updates in your original post.

Thanks @ScruffR. So our best bet is to implement interrupts. Would edge cases like (re)connect or OTA updates prevent the interrupts from functioning?

OTA upates will always cause troubles since they have to reset the device and replace the running code, so there is no way around that - but that shouldn’t come as a surprise :wink:

Reconnects should not pose too much of a problem.