AnsweredAssumed Answered

Example STM32F4xx_DSP_StdPeriph_Lib_V1.0.0 - TIM - DMA does not work

Question asked by bil.til on Jan 31, 2012
Latest reply on Feb 5, 2015 by Dan Hepler
this example code does not work (I tried on the Keil board, PA10 is there available, so not any conflicts)

The PWM frequency comes up with 17.5 kHz, as written in the example code. But the functionality, that the duty cycles changes after 3 repetitions, does not work. It always changes only between the first and the last duty cycle given in the array SRC_BUFFER. And it changes after every cycle - it does not keep the duty cycle constant for 3 repetitions as expected.

If I read the Ref Manual for the timer DMA, I would expect that DMA_InitStructure.DMA_PeripheralBaseAddr should be set to the address of TIM1_DMAR, and not directly to TIM1_CCR3. As given, the signal shows some spurios spikes, I think the reason is, that TIM1_CCR3 is addressed here directly. If you change the address to TIM1_DMAR, and invoke the configuration function    TIM_DMAConfig( TIM1, TIM_DMABase_CCR3, 1); , then these spikes are gone (I think it anyway is a clear problem of this example, that TIM_DMAConfig is not invoked - to my understanding this function MUST be invoked to set the TIM1_DCR register). But anyway the example keeps changing the duty cycle after every cycle.

Somebody has some hint how to fix this? (ST should ...).

I downloaded my STM32F4xx_StdPeriph_Examples yesterday, so all should be up to date.