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
  • I have implemented a library specifically for controlling these WS281x's using NOP calls timed to work. However, I have not tested it with the softdevice enabled and have only tried up to 4 parallel strips of 10 LED's each.

    Will report back after testing with softdevice.

  • I wrote the library in C, but the timed outputs uses inline assembly calls. I have continued testing this library because I felt I hadn't thoroughly tested it with BLE. I have found that indeed the softdevice interrupts cause an issue with the specific LED timing. Since, I have spent bits of time here and there looking for alternatives. I have been preparing a timer+gpiote program, but do not have my oscilloscope today to test it.

    You mentioned below about Radio Notification windows. Do you have a link to the documentation on this or is there an example program that shows this functionality working?

Reply
  • I wrote the library in C, but the timed outputs uses inline assembly calls. I have continued testing this library because I felt I hadn't thoroughly tested it with BLE. I have found that indeed the softdevice interrupts cause an issue with the specific LED timing. Since, I have spent bits of time here and there looking for alternatives. I have been preparing a timer+gpiote program, but do not have my oscilloscope today to test it.

    You mentioned below about Radio Notification windows. Do you have a link to the documentation on this or is there an example program that shows this functionality working?

Children
No Data
Related