SPI for 24 bits

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

The current SPI component "out of the box" supports only a bit length maximum of 16 bits.  Can the code be modified to support 24 bits?

   

I'm trying to interface to WS2801 and SM16715 LED string controllers, which have data + clock lines, and appear to be compatible with the SPI control... except they require 24 bits (8 each for red, green, and blue).

   

Seems to me (and I haven't peered into the existing code for SPI - yet) that the 16-bit limit is probably hard-coded, and if I changed the limit to 24 and stored as my own component, it should work.

   

Ultimately I'd like to implement a PSoC-compatible library of LED string controllers similar to what's done for Arduino on the FastLED.io site.  The single-line WS2811/WS2812 devices already have a PSoC component that controls multiple strings.

0 Likes
2 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The SPI is done using cascadable  8 bit wide UDBs which must be programmed using VeriLog as HDL.The UDB already contains the needed FIFOs in input and output paths.

   

Not quite an easy job, but doable.

   

On the other hand: It could be managed to transmit 3 bytes via SPI to get 24 bits as a result.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Bob, thanks.  I hadn't considered that SPI might send 3 8-bit bytes "contiguously".  I'll give that a try and see how it works. In the meantime, someone at Cypress was able to locate (or create) an SPI component supposedly configurable for up to 32 bit length data items.  I might try that as well...

0 Likes