EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

STM32: DMA and .. timers ???

Started by kristoff November 19, 2015
Hi all,



I am learning about the stm32f1xx devices, trying out some example-codes 
on using DMA with the ADC and DAC.


However, when reading the information in the reference-manual about DMA, 
it mentions DMA in combination with Timers!


Now, I am a bit confused.
As far as I understand it, the DMA is there to transfer data between 
devices (ADC, DAC, USART, SPI, I2c) to memory without using the CPU.

But where do do the timers fit in? I understand that timers are needed 
to generate events (e.g. to trigger the start of a ADC or DAC process), 
but that does not involve any RAM, no?


Or do I have a to-simple view of timers?


Cheerio! Kr. Bonne.
Hi

You can use for example byte or long DMA transfers to set the timer reload or compare capture values without CPU interaction. 

A couple of years ago I did a digital power supply in which the error signal from the error amplifier controlled the peripheral PWM duty cycle via DMA. That way I saved an external PWM controller and added the possibility to control the PWM for special functions also

You could sample with the ADC and control timer frequency the same way with no CPU load 

Cheers 

Klaus
Klaus,


(Now reply in the group insyead of via direct email).
2nd try! :-)


On 20-11-15 00:18, Klaus Kragelund wrote:
 > You can use for example byte or long DMA transfers to set the timer 
reload or compare capture values without CPU interaction.
 > A couple of years ago I did a digital power supply in which the error 
signal from the error amplifier controlled the peripheral PWM duty cycle 
via DMA.. That way I saved an external PWM controller and added the 
possibility to control the PWM for special functions also
 > You could sample with the ADC and control timer frequency the same 
way with no CPU load

Nice!

Looks I still have a lot to learn about microcontrollers!



 > Cheers
 > Klaus

Cheerio! Kr. Bonne.
On Fri, 20 Nov 2015 00:36:16 +0100, kristoff wrote:

> Klaus, > > > (Now reply in the group insyead of via direct email). > 2nd try! :-) > > > On 20-11-15 00:18, Klaus Kragelund wrote: > > You can use for example byte or long DMA transfers to set the timer > reload or compare capture values without CPU interaction. > > A couple of years ago I did a digital power supply in which the error > signal from the error amplifier controlled the peripheral PWM duty cycle > via DMA.. That way I saved an external PWM controller and added the > possibility to control the PWM for special functions also > > You could sample with the ADC and control timer frequency the same > way with no CPU load > > Nice! > > Looks I still have a lot to learn about microcontrollers! > > > > > Cheers Klaus > > Cheerio! Kr. Bonne.
The ST parts are pretty fancy. I'm fairly sure that you could also use the DMA with a timers capture feature -- each time an event happens on a capture input, the time would be recorded into memory for later perusal. But -- you'd have to check and see. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com

The 2024 Embedded Online Conference