View Full Version : OctoWS2811 design

12-30-2013, 11:48 AM
[these are really questions for Paul, I think]

Paul, first, as a disclaimer, I do not have any of your hardware, and even worse, I don't even use your software :-) I'm writing this just to discuss things and thus possibly help improve your software.

I've been looking at your OctoWS2811 library, as I needed to drive WS2812 led strips from a K20 (and KL05). I'm very impressed by the clever idea with using DMA to drive the GPIO pins directly: this is something I wouldn't have thought of.

I only want to drive one LED strip, so your code wasn't a good match. But I implemented a similar approach to yours, just driving a single GPIO pin instead of eight at a time. It didn't work all that great, which is why I wanted to ask:

* you use ports to generate DMA requests, instead of just using timer channels to do it -- why? It seems easier to use the CHF flags to generate requests, without using any external pins. That is what I did (but please see next question).

* do you get precisely timed waveforms? In my case, the delays introduced by DMA were not constant and I could not get precise timings. I'd get a waveform where some transitions would be on the order of 50ns off. This wasn't dependent on system load, the waveform always looked the same on the scope -- but certain transitions were off. Which makes me wonder: either you saw the same discrepancies, but decided they don't matter, or perhaps your approach with external pins was there for this specific purpose and helps with the timings?

I did my work with the core clocked at 48MHz (PEE mode) and using 0x01 for the FTM prescaler (24MHz FTM clock).

I finally implemented a different approach: use EPWM mode on one of the FlexTimer channels and load timing data via DMA. This works very well for a single strip, and only uses a single FTM channel and a single DMA channel. It also gives me a precise waveform. So basically my work is done, I just wanted to exchange experiences.