I’m having a performance problem with SPI when sending serial data to RGB LED strips. I have about 550 LEDS in total and constructing a buffer to send seems to take very little time but the actual transmission is pretty slow.
I’ve tried messing with the configuration speed but the documentation is so poor that I really have no idea what that’s doing.
I was wondering if SPI is a software process or by some miracle a DMA one?. For example, if I set up 2 SPI channels and send half the data to one and the other half to the other will the DMA make it more efficient or am I flogging a dead horse.
The speed, setup and hold times are all dependant on the device you are trying to talk to. Take a look at the data sheet for your SPI device. You will find this information in the specification tables or the timing diagram.
Other things can influence these settings as well. For example if you have a long wires on your SPI bus you may not be able to use as high a speed. If you are daisy chaining many SPI devices together it might affect things as well.
It might also be how you are writing to SPI, can you post a code sample?
550! We definitely need a video of that. I’ve had no trouble using spi on a spider to drive an rgb strip about 10% (60) that long. Maybe start with something smaller to isolate the issue and work your way up?
Re: 550 Ok. I’ll put up a video but I think I’m going to have to split the data across SPI’s or maybe even add another Spider.
I’d really like to know more about the way the spider handles the SPI bus. Can I use two SPI connections simultaneously for example.
Re: Daisy chain? Yes effectively you chuck all the RGB data into one end of a long chain of LEDS. These use the WS2801 controller bye the way, and the data propogates along the chain.
I’m currently doing the actual data send in the timer tick handler. I’m thinking this might be a bad idea and will probably change it soon.
Are you declaring the array globally and filling it locally? Constructing an array can be slow or actually, if the garbage collector gets involved it will eat a lot of time.
What happens if you SPI write a counter value in a loop and ignore the array completely?
Maybe also try smaller chunks.
All speculation unfortunately. Would be best to look at the source.