ws2801 fastSPI how can i do to run test

Naruto in my first post i never told about SD card.

My problem is Arduino + fastSPI + Strip ws2801

I have only srip with 4 wire: gnd, 5v, ck, sI

GND - GND
5V - 5V
ck - pin13
sI pin 11

i have put a comment before setPin and enabled chip ws2801

But doesn't work

N

#define NUM_LEDS 150

you have 150 LEDs = 150/3 RGB?

I had cut a piece of the strip.
10 rgb led and

change in

#define NUM_LEDS 10

if you have 10 rgb leds you have to put 10*3=30 leds

#define NUM_LEDS 30

Naruto128:
if you have 10 rgb leds you have to put 10*3=30 leds
#define NUM_LEDS 30

Wrong. 10 LEDs is 10 LEDs. The code knows what to do with them and how to address them in RGB.

memset(leds, 0, NUM_LEDS * 3);

That sets the memory for NUM_LEDS * 3. If you have 10 LEDs, that automatically sets it to 30 so you get .r, .g, .b for each one.

contecavour:
I have only srip with 4 wire: gnd, 5v, ck, sI

GND - GND
5V - 5V
ck - pin13
sI pin 11

i have put a comment before setPin and enabled chip ws2801

But doesn't work

Do you also go to the doctor and say 'Doctor it hurts.' without indicating what, where, or when? Do yourself a favor and read How to use this forum and then come back and post a proper reply. No one here is a mind reader. No one here knows what you've done, how you're connecting wires, or anything else. So until you can post a proper reply, you won't be getting a whole lot of help. Not from me at least.

The #define PIN 4 in there is for the chipsets that use an explicit pin, like the TM1809 or WS2811. The first version of the FastSPI_LED library - the one that you're referencing only supports using the hardware SPI pins for SPI-ish based chipsets (WS2801, WS2803, LPD8806, SM16716) and ignores the setPin call for those chipsets.

The second version of the FastSPI_LED library, which is currently in preview releases (though Mark and I are spinning up a release candidate, hopefully somewhere around memorial day or shortly afterwards), will silently drop back to using bit-banging if you set pins other than the hardware SPI pins. While, as everyone here points out, hardware SPI is faster than bit-banging, it turns out that the bit-banging code that I wrote for FastSPI_LED2 can push nearly 2.5Mbps data rates (and over 4.5Mbps on the teensy 3) which is well above the 1Mbps data rate that the WS2801 really prefers to be run at.

dgarcia42:
The #define PIN 4 in there is for the chipsets that use an explicit pin, like the TM1809 or WS2811. The first version of the FastSPI_LED library - the one that you're referencing only supports using the hardware SPI pins for SPI-ish based chipsets (WS2801, WS2803, LPD8806, SM16716) and ignores the setPin call for those chipsets.

The second version of the FastSPI_LED library, which is currently in preview releases (though Mark and I are spinning up a release candidate, hopefully somewhere around memorial day or shortly afterwards), will silently drop back to using bit-banging if you set pins other than the hardware SPI pins. While, as everyone here points out, hardware SPI is faster than bit-banging, it turns out that the bit-banging code that I wrote for FastSPI_LED2 can push nearly 2.5Mbps data rates (and over 4.5Mbps on the teensy 3) which is well above the 1Mbps data rate that the WS2801 really prefers to be run at.

Hello, I am trying to connect the chipts WS2801, and Sd Card, the port
SPI, but as the WS2801 chits, no CS pin.

as can fix this?,
there will be some chits With Spi port, which make bridge between chipts WS2801 and Arduino Spi port?

You would need to wire your own select pin support that blocks the clock/data line to the ws2801. There's nothing you can do to work around that if you want to use the hardware SPI pins.

Again, the next version of the library will allow you to easily use the non-hardware SPI pins with the ws2801 - but there is no way to do that with the first version of FastSPI_LED.

dgarcia42:
You would need to wire your own select pin support that blocks the clock/data line to the ws2801. There's nothing you can do to work around that if you want to use the hardware SPI pins.

Again, the next version of the library will allow you to easily use the non-hardware SPI pins with the ws2801 - but there is no way to do that with the first version of FastSPI_LED.

hello, I've tried your library v2, but I have not worked. I have uncommented this line WS2801Controller <11, 13, 10, 0> LED;
I have put the number of LEDs that I have and nothing.

This library allows you to use sd card and WS2801??, without hardware modifications?

v1 the library I work, no problems

There's a bug with WS2801 support in the most recently published preview release - I'm still working on getting a next release put together - hopefully in the next week or so.

However - with the new library when you get it (if you PM me I can send you a one off build of it - or you can get the next release when it comes out after memorial day) - you will have to put the WS2801 strip on -different-pins- - they can't use the same pins as the SD card - unless, as mentioned previously, you want to add hardware to provide the CS support.

I was inspired a bit, its library, and I've written this code to work with the WS2803, or ws2801
I have taken directly the SPI library, and I think I got the same
speed. traee the advantage that this support can be any
PIC, Arduino IDE support, without having to modify, for example PIC 32.

THE only thing missing is sort of ordering off of the LEDs lit, nenor to highest, which is halgo easy to do.

////                     By   Omni
//  * CS - to digital pin 10  (SS pin)
//  * SDI - to digital pin 11 (MOSI pin)
//  * CLK - to digital pin 13 (SCK pin)
 

#include <SPI.h>

#define nLEDs 162

uint8_t ledBar[nLEDs]; // Array representing LED PWM levels (byte size)




void setup() {
  
        SPI.setClockDivider(SPI_CLOCK_DIV2) ;
        SPI.setBitOrder( MSBFIRST) ;



  SPI.begin(); 

}

void loop() {
for(int ii = 0; ii < 250; ii++){

for(int i = 0; i <  nLEDs; i+=3){
      ledBar[i] = 123 ;   //  R
      ledBar[i+1] = 22 ;  //  G
      ledBar[i+2] = 2 ;   //  B
  
    }

        loadWS2803();
        
}      
        for(int i = 0; i <  nLEDs; i++){
      ledBar[i] = 0;
      ledBar[i+1] = 0;
      ledBar[i+2] = 0;
  
    }

        loadWS2803();
        
         delay(2900);
  
}

void loadWS2803(){
    for (int wsOut = 0; wsOut < nLEDs; wsOut++){
             SPI.transfer(ledBar[wsOut]);
    
    
    
    }
    
 delayMicroseconds(500); // 600us needed to reset WS2803s
}

With the WS2801, since the top SPI speeds available in hardware are far too fast for the WS2801, it doesn't matter much how well the SPI code you're using performs. Other chipsets like the LPD8806, can run faster than the top speed you can get with bitbanging, and even faster than the top speed a lot of naive spi implementations can get.