AnsweredAssumed Answered

KSDK 2.0 EDMA + FTM + GPIO, early start of DMA request

Question asked by Matthias Jugel on Aug 11, 2016
Latest reply on Aug 15, 2016 by xiangjun.rong



I tried reimplementing Erich Stygers code for KSDK 2.0. However, I see a strange problem where the second round of setting up the DMA channel request initiates the first DMA request earlier than expected.


I use 3 FTM timers as triggers for the EDMA request. I also de-initialize FTM, DMA and GPIO before and after the process.


The code can be found here: K82F EDMA PWM WS2812b (Kinetis SDK 2.0) · GitHub


The first time I send data to the LED using this method everything is fine. All the bits are sent perfectly.

The second time however, as soon as the code enables the DMA transfer in K82F EDMA PWM WS2812b (Kinetis SDK 2.0) · GitHub:215 (EDMA_StartTransfer) it will send out the first bit, however since there is some more code before the timer is started and triggering the actual DMA this bit is way too long as can be seen in the following picture:


Screen Shot 2016-07-19 at 15.46.40.png

You can see the timers starting in channel 01, 02, 03 and the next bits are also fine, just what is between A1 and A2 is wrong.


I tested it a few times, but it looks like the DMA request to the GPIOD->PSOR is triggered too early. As if the EDMA is not reset completely. Since I set the FTM timer as a trigger source for the DMA transfer it should not happen as I enable that timer much later on.


Any help will be appreciated.