DMA and OC MODE
Hi,
1. Project Purpose: Generate pulse to control stepper Driver.
2. My method and step:
1) every 2 milisecond calculate out the pulse need to send next cycle;
2) DMA and Timer Handle the pulse sending.
a. Timer update interru 3pte cycle is 2ms, ARR = 56000.
b. enable OC compare output , Toggle mode
C. Timer count from 0~56000, CCRx will be a series value attempt to toggle the output.
For example, I want to generate 2 pulse in 2ms cycle, Then I need to set CCRx to 14000 , 28000, 42000, 55999 step by step.
d. Using DMA to Send CCRx Array.
e. Using DMA Double Buffer mode.
3. My Question:
1) All work right when the pulse frequence below 100kHz
2) It seems that above 100KHz, DMA will be too slow to push the newer CCRx value to the peripherial. So the pulse will lose.
for exmaple:
a. last cycle 100puse / 2ms
b. DMA should TC interrupe first then Timer update interrupe,
c. But What I debug found is After DMA interrupe, Timer CNT have been exeeced and be arround 2000 of 56000.(0...56000 => 0... 2000)
3) Another question: I found that , DMA CCRx value pushing would be affect by other thread, for example 100 pulse /200ms, actually , we will lost 80% pulse per cycle.
