ws2812(Adafruit NeoPixel) DMA

https://github.com/ekbduffy/Spark-Neopixel-DMA - here is a library. Its working with DMA and ws2812.
It’s sending arrays of data thru Direct Memory Access system, without usage of microcontroller tics on sending data.
So it’s don’t need now to use __disable_irq() to send data, like in Adafruit NeoPixel library.
But! I need help :slight_smile:
It’s working, as i see on my Salae Logic Analyzer - it’s sends out good data.
But my leds are flicking.
And if i run this library in looped increasing by 1 of each color on one led pixel - i’ve periodically get brighter color (than others in series). But as i see in analyzer - there are correct numbers. I’ve tried to use 3.7v battery - not helped. I’ve tried to use BDubs library - it works fine.
Maybe somebody have skills and possibilities to help me find an error, and we will make a great finished lib :slight_smile:

Hi,

Did you take a look at OctoWS2811 from Paul Stoffregen ? He has a library for Teensy with 8 data outputs and capable of controlling 8 ledstrips in parallel. Maybe you can find ideas in that library to finish your work.
I’m looking forward to test it in the coming days.

I’ve looked on all libraries driving ws2812 thru DMA on cortex-m.
two on them i’ve took as base to my lib. OctoWS i’ve didn’t touched, because there are not STM32 MCU…

Now i’ve spent few hours on debug. And catch random flicks into Logic Analyzer,
Here is sended 22;22;22 to one led:

Here is 23;23;23 to one led:

So it looks like DMA didn’t sent first bit of data or buffer is broken.
I’ve checked buffer with printing to serial - it’s ok.
Is here anybody, who can help me with DMA settings?
My settings can be checked here https://github.com/ekbduffy/Spark-Neopixel-DMA/blob/master/firmware/neopixel-dma.cpp in void ws2812::init function. I’m filling DMA_MemoryBaseAddr array with 15 and 6. So it’s show a pretty good timings.

Searched about it in google - first opened link http://www.eevblog.com/forum/microcontrollers/stm32-timer-running-slow-on-first-dma-transfer/ about ws2812:) so guys told about preload, but it already in my config:
TIM_OC1PreloadConfig(TIM4, TIM_OCPreload_Enable);

Any of DMA users here? Can somebody help me with this issue?
I’ve tried to ask non-spark microcontroller programmers and guys told me that there is possible “race conditions” but i can’ see where it can be…