This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Driving WS281x RGB LEDs from an nRF51822

Hi Guys,

I'm new to using the nRF51822 environment but I've used AVRs for years, so please be gentle...

I'm wanting to drive a strip of WS2812 RGB LEDs from an nRF51822 processor. Ultimately I want to control it over BLE but initially I need to drive the LED strip first.

Here's the WS2812 datasheet:

The WS2812 RGB LEDs have a single data line that daisy-chains between devices and it has bit timings of about 1.2us where a 0 bit is High for .35us and Low for 0.8us and a 1 bit is High for 0.7us and Low for 0.8us.

One implementation on the AVR's disables interrupts and uses hand coded assembler to generate the right bit timing. Another implementation configures the SPI port to generate the correct bit timings by sending different byte values such that the different 1's and 0's generate the desired waveform.

There's a cleaver implementation on the Teensy 3.0 board here: www.pjrc.com/.../teensy3.html that uses the OctoWS2811 library that uses DMA and some timers to clock out the bit streams for 8 LED strips in parallel from buffer in SRAM at almost no CPU overhead.

I like the idea of using DMA however, looking at the nRF51822 it doesn't seem to have this capability.

Any suggestions?

Regards

Alex Shepherd

Parents Reply
  • Ran a quick and simple test using the UART ble program to turn on a new LED at red for each serial packet collected and to turn off all LEDs on a write from the phone to the characteristic. Seems to run regardless of the softdevice running.

    I have read into that makeshift SPI setup and seen the Teensy library, but again decided to implement my own NOP based library.

    Sorry that I am not capable of sharing the code at this time.

Children
No Data
Related