2014-11-27 01:48 AM
I found an example in the stm firmware. It is TIM DMA Burst. The configuration code is as in this link
But I dont understand how it works. Here is my questions: _ FromTIM_DMACmd(TIM1, TIM_DMA_Update, ENABLE);
I am not sure what TIM_DMA_update is? Is it that: when the timer reload CNT register, it will trigger DMA to run? How about in the caseTIM_RepetitionCounter!=0?
_What if I change to
TIM_DMACmd(TIM1, TIM_DMA_CC1, ENABLE);
How does it suppose to behave?????
_my final objective is to update both ARR and CCR1 at runtime by using DMA. So I modify the code so that it can changeaSRC_Buffer at a certain time.I guess it has to do withDMA_Mode_Circular so I change the configuration to follow
DMA_InitStructure.DMA_Mode = DMA_Mode_Circular;
and
uint16_t aSRC_Buffer[6] = { 10000, 1, 1000, 10000, 0, 9000 };
so the first set will make arr=10000, rcr=0, ccr1=1000. It will create a wave: short low and long high. (lets call it wave A). After 1 wave cycles, the TIM1 will be updated to arr=10000, rcr=0, ccr1=9000, and draws the next 1 wave cycles: long low n short high (waveB). It is expected that there are 1 wave A+ 1 wave B n go on. However, when I observe on the my scope, I see 1 wave A but 2 wave B. I tried to change the array value but still cannot guess what the principle is. Can you help me to explain my observation?
#stm32 #discovery #dma #stm32f4 #stmf4 #isr