1

Was wondering if anyone is familiar with this - I've got the RPi working as an LED controller, sending digital color data 60 times per second to some WS2801 LED controller chips. Everything's working fine - I'm using c++ and the bcm2835 library for GPIO, and the process just sends 3 quick bytes over 2 GPIO pins then sleeps the remainder of the 1/60 sec - except for a weird intermittent problem:

Every minute or two, the Pi will go into a weird pattern where it stalls for 1 second, then resumes for 1 second, stalls for 1 sec, resumes 1 sec, repeating this anywhere from 2 to 30 times before resuming normally. The 1-second on/off is very precise.

Not sure what this stall is exactly - I've got a rapid blink pattern (30 blinks/sec) running to help troubleshoot. Normally the blinks are smooth, except during the stall, where the light is stuck on or off for 1 second intervals - this is how it would behave if GPIO data stopped outputting during the interval, so I assume that's what's happening.

Any ideas? Weirdly when I run "top" to see if it's a background process, the stalls never happen. Only when "top" isn't running.

  • 1
    OK, stupid coding mistake here. My timing was based on gettimeofday(), and I was assuming the microsecond portion could be used alone. But I needed to multiply the "second" portion by 1,000,000 and add that in also. So not doing that caused some weird problems. – QuadrupleA Mar 7 '13 at 0:57
  • Hi and welcome @QuadrupleA to raspberry pi stackexchange. If you have managed to solve your own question, move your comment into an answer of it's own rather than a comment, then you can select it (in a couple of days) as the correct answer. This helps us not have unanswered questions! – kolin Mar 7 '13 at 9:02
  • 1
    Unfortunately StackExchange doesn't let me provide answers yet - that was the first thing I tried :). – QuadrupleA Mar 7 '13 at 9:27
0

Just got the privilege to answer my own questions, so here's the earlier comment:

Stupid coding mistake here. My timing was based on gettimeofday(), and I was assuming the microsecond portion could be used alone. But I needed to multiply the "second" portion by 1,000,000 and add that in also. So not doing that caused some weird problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.