AnsweredAssumed Answered

DMA Weirdness

Question asked by synic on Oct 21, 2014
Latest reply on Nov 24, 2016 by wang.alan.004
Hello all,  I'm trying to run a ws2812 strip using a timer and DMA.  I'm using the stm32f303vct6 chip at 48MHz.  

The Timer is running with no prescaler, and no clock division in PWM1 mode, with a period of 60 (1.25us), for a data rate of 800kHz.

For ws2812, the data is sent with 1 being longer than 0 - basically I modify the compare value with dma to get the correct output.

Currently it works, for the most part, if I use a compare value of 26 for HIGH, and a compare value of 16 for LOW.  However, this timing isn't perfect, and doesn't seem to work with all ws2812 LEDs.  

If I try to make the LOW shorter, say, 14, or the HIGH longer, say 28, weird things start happening in the output.  The 1s have spikes in them.

This picture shows what I see if I use 16 and 26:


This is what it looks like if I change HIGH to 28:


And here's a closer view of that weird spike:


My code can be found here:

What am I doing wrong here?  As I understand, in PWM1 mode, the signal will remain HIGH until the compare value is reached, and then it should go LOW.  How can it suddenly go back HIGH again like that?