I am trying to get my custom built RGB LED display running with my pyBoard. It's based on WS2803 chips which are basically 18-channel WS2801 (Protocol described here on page 6: http://www.jarzebski.pl/datasheets/WS2803.pdf).
I already tried bit banging the protocol which worked. But this is a bit slow, so I want to use SPI for the job. On my old Arduino-based controller I successfully used this SPI-code:
Code: Select all
/**
Writes the frame buffer's content to the display via SPI
**/
void WS2801Display::refresh(void)
{
uint16_t byteCount = pixelCount * 3;
for(uint16_t i=0; i<byteCount; i++) {
SPDR = frameBuffer[i];
while(!(SPSR & (1<<SPIF)));
}
delay(1); // Data is latched by holding clock pin low for 1 millisecond
}
I am using SPI 2 and connected the WS2803's SCK to Y6 and DATA to Y8.
What I'm trying now on my pyBoard is:
Code: Select all
from pyb import SPI
spi = SPI(2, SPI.MASTER, baudrate=20000, polarity=0, phase=0)
framebuffer = bytearray(168*3) # 168 is the amount of rgb pixels in my display
for i in range(168*3):
framebuffer[i] = 10 # write some data to the buffer, for testing
while True:
spi.send(framebuffer)
pyb.delay(1) # latch data

Do you have any suggestions?
Thanks in advance!
Cheers,
Robert