btesser / boblight

Automatically exported from code.google.com/p/boblight
GNU General Public License v3.0
0 stars 0 forks source link

Boblightd on Raspberry with spidev (ws2801 led strand) uses too much cpu. #57

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Setup boblightd on Raspberry Pi with spidev device and connect ws2801 led 
strand
2. Connect remote via boblight-x11 or xbmc-boblight addon to boblightd
3. Under x11 do nothing, in xbmc pause video

What is the expected output? What do you see instead?
The light should not change color or do anything. Instead i see permanent 
flickering

What version of the product are you using? On what operating system?
Rapbian:
Linux boblight 3.6.11+ #366 PREEMPT Wed Jan 30 12:59:10 GMT 2013 armv6l 
GNU/Linux

Please provide any additional information below.
The Load is above 2.00 (since the raspberry pi has one cpu, it is high)

I think boblight and the network interfaces uses too much cpu power so that 
boblight can't send the required data via the spi devices and the ws2801 strips 
start flickering.

Original issue reported on code.google.com by andreas....@gmail.com on 8 Feb 2013 at 6:16

GoogleCodeExporter commented 8 years ago
I forgot to mention, if i stop boblightd, the load average goes down.

Original comment by andreas....@gmail.com on 8 Feb 2013 at 6:21

GoogleCodeExporter commented 8 years ago
Here is my config file. I also tried different baud rates/intervals.

Original comment by andreas....@gmail.com on 8 Feb 2013 at 7:18

Attachments:

GoogleCodeExporter commented 8 years ago
This seems to be because of writing to the spi port.

Original comment by bob.loo...@gmail.com on 8 Feb 2013 at 8:18

GoogleCodeExporter commented 8 years ago
It seems like this issue isn't related to the spi port on the raspberry pi.

I also got flickering if i attach an arduino to the raspberry pi. So the led 
strand is driven the arduino instead of the spi port.

With the arduino the cpu utilization is below 20%. 

Bob do you got an arduino and raspberry to reconstruct this issue?

Original comment by andreas....@gmail.com on 15 Feb 2013 at 10:27

GoogleCodeExporter commented 8 years ago
I forgot to mention that the arduino is running the adalight pde from adafruit:
https://github.com/adafruit/Adalight/tree/master/Arduino/LEDstream

Here is my boblight.conf with the arduino attached.

After a few minutes it looks like the cpu utilization goes up and up and up...

Original comment by andreas....@gmail.com on 15 Feb 2013 at 10:32

Attachments:

GoogleCodeExporter commented 8 years ago
I've been seeing this too using a similar conf to the the original poster, avg 
load is about 2.0 but the cpu usage for boblightd is around 20 - 25%.

I changed the interval to 20000 and the rate to 1000000 in boblight.conf and 
load avg is now about 0.50 - 0.60 although I've only tested this for about an 
hour.

Original comment by galactic...@gmail.com on 24 Mar 2013 at 10:25

GoogleCodeExporter commented 8 years ago
Hi,

I have the same problem, but i and Heven from (ihad) have fixed this :)

I have deleted some stringparsing, the stringparsing need to much cpu usage.
And in devices.cpp i have changed the CLAMP function:
  m_currentvalue = Clamp(m_currentvalue, 0.0, 1.0);
to
  if(m_currentvalue < 0.0f)
  {
    m_currentvalue = 0.0f; 
  }
  else if(m_currentvalue > 1.0f)
  {
    m_currentvalue = 1.0f;
  }
I think the -O2 optmalization will kill the CLAMP.

Replace the client files in src/
and Replace device.cpp in /src/device/

Now recompile the daemon, and it will work!
But DONT'T FORGET to change your light-names in boblight.conf to XX1 XX2 XX3 
etc...
The lightnames must be 3 chars. See atachement for preview.

Gr Speedy1985

Original comment by boblight...@gmail.com on 29 Mar 2013 at 6:07

Attachments:

GoogleCodeExporter commented 8 years ago
Awesome work!
I faced similar issues with a 8806 LED strand and started profiling boblightd 
myself. My initial thought was the SPI driver, but I was looking in the wrong 
place...
The patch in msg #7 reduced my avg. CPU usage from 96% to 58%! (234 LEDs, RPi 
overclocked to 950MHz)
Thanks
Markus

Original comment by zehn...@gmail.com on 29 Mar 2013 at 10:50

GoogleCodeExporter commented 8 years ago
I have made a optimized version for raspberry, see 
https://github.com/Speedy1985/boblightd-for-raspberry/wiki/How-to-compile

Gr Speedy

Original comment by boblight...@gmail.com on 6 Jun 2013 at 7:10

GoogleCodeExporter commented 8 years ago
After compiling (as described in the link in post #9) do I need to copy the 
file from /usr/lib/ and /usr/bin/ to somewhere else or is the file at the right 
place? 
I followed the How to by Speedy and everything looked good but after switching 
boblight on 1080p movies freeze from time to time.

Original comment by cjeschk...@googlemail.com on 11 Jun 2014 at 12:47