APM source code - interrupts?

I was quickly browsing over the source code for APM 2.6. I noticed that the main loop uses just some straight up timers to check for how often update routines are called and so forth.


Are there any benefits to modifing this code to use interrupts or TimedAction to ensure that the loop doesn't get stuck? (you would also have to do some mutex logic if that's needed also).


I deal with this problem on a similar project where reading from a UART might timeout and so forth. I would think in a real time environment this is even more critical.



You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –


  • Developer


    Have you tried prototyping something? The FastSerial library uses an interrupt timer, but I do not know if the hardware supports more interrupts or how it would benefit the performance of the code. 

    I am not aware of any problems with code "freezing". The main goal on the APM is simply to run the loops as fast as possible, since the CPU is not too powerful and (at least for copters) you need a high sampling rate to stabilize the platform. So one consideration might be whether loops are faster than re-entrant interrupt callbacks. 

This reply was deleted.


Liam left a comment on Agricultural UAVs
I'm Liam from T-MOTOR. I would like to reach out to see if there is any possibility for us to work together.
We are a propulsion system manufacturer who offers motors, propellers and ESCs for all kinds of drone applications which vary from secur…"
Jun 30
Richard Cox left a comment on Australia
"Anyone in the DIYDRONES Australian subgroup based in Alice Springs, NT?
I am experimenting with Ardupilot (standard Arduplane), Pixhawk 4 FC in a 4-ch
RC "AXN Floater Jet" foamy plane..."
Jun 29
Omar Sykes left a comment on Australia
"Hi everyone, I am looking for someone who is good at drone building, repair and software in Adelaide. Please give me a call on 0477 319 219."
Jun 29