I am working with a TWR-K64 board and Kinetis KDS v3.2.0 with Processor Expert (no SDK).
After quite a lot of struggle time I succeeded making DMA work, but unfortunately not as fast as I need. This is the example project I developed to work with:
- Every time the tact-switch SW3 from TWR-K64 board is pressed, a PWM signal is generated in PTD5 pin.
- Every rising edge of this pin a DMA data transfer is completed, from a source array to a destination array.
- After 8 data transfers, the Major loop finished interrupt is executed and PWM is disabled, until SW3 is pressed again.
The example works fine when the PWM signal period is about 200ns or higher, but I need to generate a faster PWM signal. When the PWM is configured with a period of 133ns, using an oscilloscope I can see that after 8 rising egde the PWM signal is disabled. So I assume that it is working ok. However, sometimes it needs 9 pulses and some others 16 pulses to be finished. Please have a look to the scope images.
Does it mean that DMA can´t work so fast? I need the PWM to work at a period of 50ns aprox. What can I do?
I followed this post from mcuoneclipse.com to configure the board to the maximum speed.
I would appeciate your help.
Thank you in advance.