To give you an idea why a simple little Linux board (the Carambola on OpenWrt in this case) is not a convenient platform for real-time use, let me show you some snapshots.
I’ve been trying to toggle two I/O pins in a burst to get some data out. The current experiment uses a little C program which does
ioctl(fd, GPIO_SET, ...) and
ioctl(fd, GPIO_CLEAR, ...) calls to toggle the I/O pins. After the usual mixups, stupid mistakes, messed up wires, etc, I get to see this:
A clean burst on two I/O pins, right? Not so fast… here’s what happens some of the time:
For 10 ms, during that activity, Linux decides that it wants to do something else and suspends the task! (and the system is idling 85% of the time)
If you compare the hex string at the bottom of these two screenshots, you can see that the toggling is working out just fine: both are sending out 96 bytes of data, and the first few bytes are identical.
The situation can be improved by running the time-critical processes with a higher priority (
nice --20 cmd...), but there can still be occasional glitches.
Without kernel support, Linux cannot do real-time control of a couple of I/O pins!