Hi joe joe,

There is more than one way to do it. Below is one simple suggestion. Depending on how accurate your 1-second timing has to be, it may be all you need. I am sure that others will contribute other, more elegant and/or more powerful methods.

This method assumes that the SPI writing is synchronous. This is why the 2nd gettimeofday() is necessary, to find out how long the SPI write took. I've used this type of code for simple things, and so far it has served pretty well, but on the other hand I'm not sensitive to jitter of 10s of microseconds in the 1 second intervals.


On 10-Aug-2011 00:13, joe joe wrote:
I'm trying to implement a user-space thread whose only task in life is to
write to send some message via the SPI bus once a second.  

I imagine I have to get timers involved for this but have no clue how to go
about starting or accessing one through linux.  Does anyone have any
pointers for how to go about doing this?