Help - Max SPI speed with Raspberry Pi 3

1,073 views
Skip to first unread message

Antonio Spadafora

unread,
Aug 8, 2017, 7:33:20 AM8/8/17
to open-lighting

I'm trying to figure out what is the maximum number of RGB LEDs that can be controlled with a good refresh rate using a single Raspberry Pi 3. So it would be useful to know which is the maximum speed available for the SPI with Raspberry 3. I read several things but I didn't get a full answer. Thanks

Stefan Krüger

unread,
Aug 9, 2017, 5:40:27 AM8/9/17
to open-lighting
i think the easiest way to find what works for you is to test it out...
what led-type do you want to use?
for the APA102 i have tested some timings:
http://blog.s-light.eu/ola-spi-apa102/

from the picture and the overview at elinux.org i would say its an Raspberry Pi Model B from about 2012.
hope that helps in some way..
i have no rpis available so can't test it currently.

sunny greetings
stefan

Antonio Spadafora

unread,
Aug 9, 2017, 6:06:17 AM8/9/17
to open-lighting
Hi, thanks for the answer!
It's good to know that you succeed in mange 1000 leds.
I'm about to install at least six 5 meter strips. Each strip contains 160 leds. So I should not be so far away from that number.
The strips are ws2801 based.  Hope it's gonna works.

Peter Stuge

unread,
Aug 9, 2017, 5:07:14 PM8/9/17
to open-l...@googlegroups.com
Antonio Spadafora wrote:
> > what led-type do you want to use?
>
> I'm about to install at least six 5 meter strips. Each strip
> contains 160 leds. So I should not be so far away from that
> number.
>
> The strips <> are ws2801 based. Hope it's gonna works.

The WS2801 datasheet says "data and clock can be transmitted up to 6
meters at 2MHz" so you are likely limited to that by the driver.
Each frame starts with 500µs reset, each LED takes 24 bits, one bit
takes 500ns to transmit at 2MHz so each LED takes 12µs. All LEDs:
5*160*24/2000000 = 9.6ms so you can achieve 104Hz refresh with good
software. In practice you will not achieve that, but maybe 60Hz. :)


//Peter

Dom Ostrowski

unread,
Aug 10, 2017, 4:26:32 AM8/10/17
to open-lighting
You may have missed it as it's buried in another post, spidev0.0-spi-speed in ola-spi.conf does not set the clock speed correctly - actual speed, measured with a scope, is a factor of about 1.6 times slower.
(measures values: default 1000000 results in a 640KHz clock, 8000000 in 5MHz, 12000000 in 7.5MHz)

As my application had a maximum of 8MHz at the slave end, I have never tested beyond 7.5MHz

Peter Newman

unread,
Aug 10, 2017, 6:33:22 AM8/10/17
to open-lighting
Hi Dom,

Have you got a link to the other post or any more detail on the issue?

I've created an issue on GitHub to track it:
https://github.com/OpenLightingProject/ola/issues/1293

I assume this is on a Pi? Does changing the SPI output protocol to different pixel types have any effect?

Some of the stuff here seems to suggest it's more likely to be a Pi/Linux issue than a problem with our code specifically:
http://elinux.org/RPi_SPI#Speed
Message has been deleted

Antonio Spadafora

unread,
Aug 11, 2017, 7:49:15 AM8/11/17
to open-lighting
So the maximum speed I can use with this type of strip at 6 meters is 2mhz...
What if I have a longer chain? In my case I have to connect 6 strip in series so I have  a chain of 30 meters...Should I set a slower spi speed? Which leds do you suggest to use?

Peter Newman

unread,
Aug 11, 2017, 4:38:44 PM8/11/17
to open-lighting
Hi Antonio,

Have a look at some of the documentation here:
https://www.openlighting.org/ola/tutorials/ola-led-pixels/#OLA_SPI_Plugin

It should help to explain the timing constraints/issues.

Dom Ostrowski

unread,
Aug 12, 2017, 1:12:14 PM8/12/17
to open-lighting
Hi Peter - Sorry, I don't have a lot of data, just 3 spot frequencies I measured at.

OLA 0.10.3 with the SPI / GPIO outputs on a Raspberry Pi 3B

From the last post on that thread:
"Incidentally, spidev0.0-spi-speed in ola-spi.conf does not set the clock speed correctly - actual speed, measured with a scope, is a factor of about 1.6 times slower.

(measures values: default 1000000 results in a 640KHz clock, 8000000 in 5MHz, 12000000 in 7.5MHz)"

Reply all
Reply to author
Forward
0 new messages