Compare commits

..

1 Commits

Author SHA1 Message Date
Markus Koch 632772d4b7 Document WS2812B level shifter erratum 2021-07-17 23:07:24 +02:00
5 changed files with 11 additions and 15 deletions

View File

@ -12,3 +12,7 @@ Board to run [colorchord2](https://github.com/cnlohr/colorchord) on a string of
* Workaround: Flip 180 degrees and solder shifted onto the right pads, then use magnet wire to connect the remaining two pads.
* Serial boot loader non-functional (uses incompatible UART I/Os).
* Workaround: Program via JTAG / SWD.
* Missing level shifters for WS2812B LEDs (RX)
* Workaround: Don't use WS2812B RX inputs on the board
* Missing level shifters for WS2812B LEDs (TX)
* Workaround: The first LED will kinda sorta do the level shifting for you, but sometimes fail to display correctly. Just ignore its erratic blinking.

View File

@ -2,8 +2,8 @@
#define _CCCONFIG_H
#define CCEMBEDDED
#define NUM_LIN_LEDS 66
#define USE_NUM_LIN_LEDS NUM_LIN_LEDS
#define NUM_LIN_LEDS 60
#define USE_NUM_LIN_LEDS 60
#define DFREQ (40000)
#endif

View File

@ -179,7 +179,7 @@ int main(void)
this_samp = (this_samp+1)%CIRCBUFSIZE;
wf++;
if( wf == 128 * 2)
if( wf == 128 )
{
NewFrame();
wf = 0;

View File

@ -282,14 +282,13 @@ void SendSPI2812( unsigned char * lightarray, int length )
static const uint8_t aoarray[4] = { 0b10001000, 0b10001110, 0b11101000, 0b11101110 };
int i;
int subdiv = 0;
uint8_t * buffbase = &MyBuffer[ZERO_BUFFER];
if( length > SPI2812_MAX_LEDS ) length = SPI2812_MAX_LEDS;
if( length * SPI2812_LED_SCALING > SPI2812_MAX_LEDS ) length = SPI2812_MAX_LEDS;
for( i = 0; i < length;)
MyBuffer[0] = 0;
for( i = 0; i < length; i++ )
{
uint8_t * colorbase = &lightarray[i*3];
uint8_t * buffbase = &MyBuffer[i*24/2+ZERO_BUFFER];
int j;
for( j = 0; j < 3; j++ )
@ -301,17 +300,11 @@ void SendSPI2812( unsigned char * lightarray, int length )
*(buffbase++) = aoarray[(c>>2)&3];
*(buffbase++) = aoarray[(c>>0)&3];
}
if (++subdiv == SPI2812_LED_SCALING) {
subdiv = 0;
i++;
}
}
for( i = 0; i < ZERO_BUFFER; i++ )
MyBuffer[i] = 0;
length *= SPI2812_LED_SCALING;
length *= 24/2;
length += ZERO_BUFFER;

View File

@ -6,7 +6,6 @@
//24 bits per LED, can fit two bits per byte of output.
#define SPI2812_BUFFSIZE (SPI2812_MAX_LEDS*24/2)
#define SPI2812_LED_SCALING 3
void InitSPI2812();
void SendSPI2812( unsigned char * lightarray, int leds ); //Need one R, G, B per element.