@jlawson:
interesting; I am attempting to do the same with a slightly different approach. I am setting the DCO to about 6.4MHz as a source for SPI SIMO, and use 8 bits for 1 WS2812 bit, as you do, but with 0xf8 for a 1 and oxe0 for a 0, which is 0b11111000 and 0b00011111, respectively. That amounts to 0.15725us per bit, so a 1 is 0.78us high, 0.468us low. Seems to be within the range of the ws2812.
I'm having some difficulties (really beginning with this stuff) using the following test code:
WDTCTL = WDTPW + WDTHOLD;
//aiming for 6.4MHz;
BCSCTL1 = 0xd;
DCOCTL = 0x05 << 5;
//spi master on 1.2
UCA0CTL1 |= UCSWRST;
P1SEL = BIT2;
P1SEL2 = BIT2;
UCA0CTL0 = UCSYNC + UCMST + UCMSB + UCCKPH;
UCA0CTL1 = UCSSEL_2;
UCA0CTL1 &= ~UCSWRST;
while(1){
UCA0TXBUF = 0x55; //01010101
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF = 0x0;
__delay_cycles(4000); //just so the scope can trigger
}
I suspect the mcu can't source SPI fast enough. Is that why you chose to run at 16MHz?