peteg's blog - hacking - nixie clock - 2010 01 17 LinuxRTAhoy

Real-time and high-resolution timers for Linux 2.6.29.6 running on the ts7260

/hacking/nixie_clock | Link

I got bitten by the classic Linux-ism: the standard resolution of usleep is only 10ms on these ARM boards, which is way too slow to do the kind of multiplexing the clock needs: I need delays of about 2ms and could use 100µs. I'm allergic to busy-waiting in user-space too.

The short story is that I tried 2.6.31.x and couldn't get the board to boot, but 2.6.29.6 works fine, after some mild futzing in applying the patch in the ts7260 forum's file area at Yahoo. It does not provide high-resolution timers for the ARM ep93xx which the ts7260 is blessed with, though. One can readily apply the RT patches to 2.6.29.6, but these also do not include the hrtimers stuff; one needs a further, not so clean patch to get these working.

So the clock now seems to scan OK, with no flicker visible to my eyes (on the single tube I have installed so far). Well, that's true provided that no other process is running. I've selected the right scheduler, cranked up the priorities, locked the program's virtual memory, and generally futzed with no improvement in robustness under load.

As has been true for a long time, there is some ts7260 stuff in the latest Linux kernel (2.6.32.3), and apparently the RT patches have been merged to the mainline. (I cannot really tell, but the CONFIG_PREEMPT_RT and friends options are there.) I'll see if I can get that to boot and perhaps figure out the hrtimers story there.

An aside: here's a good post on the proper treatment of SIGINT.