cancel
Showing results for 
Search instead for 
Did you mean: 

Variable frequency pulse train for pulse transformer application

arre24
Associate II
Posted on August 22, 2012 at 17:22

Hi

The objective is to create a

variable frequency

pulse train with as little CPU intervention as possible.

This was quite straightforward with the TMS320 TI MCU. It had a feature called ''PWM chopper'' where it was possible to configure frequency, pulse width, duty cycle and number of pulses.

To achieve the same kind of functionality with the STM32F4, the idea that first came to mind was to use the Advanced Control Timer & DMA peripheral.

A table which consists of the timer periods that define the pulse train characteristics is setup in RAM. The have the DMA transfer these values to the timer compare register using memory increment mode. The timer output pin is configured to toggle at every compare match. 

Also, it is desired to have control of the time interval between each consecutive pulse train. Therefore a timer capture/compare interrupt is enabled. In the interrupt, the pulse train starting time (first positive flank) is defined as:

Current time (time when the interrupt occurs) + A settable delay

The time when the next interrupt occurs is also settable.

The questions are:

1) Is the method described above possible with the STM32F4?

2) Are there any other ways to get the same result?
53 REPLIES 53
webmaster
Associate II
Posted on March 26, 2015 at 07:46

No works well .. Maybe I did not understand the steps.

It is a commentary on the double buffer based on a RAPID reading. I have not implemntado. I seemed at first code more flexible to change.

Garnett.Robert
Senior III
Posted on March 14, 2017 at 06:49

Hi,

I have the same problem. I'm trying to make a short chirp centered on 40 kHz. To get a 50% duty cycle which is rough enough for my chirp I used a second timer clocked by the first.  In this way only the ARR period reg needs updating via DMA. Problem is after the first update the ARR gets loaded wit 0 rather than my sorted array so the timer stops.

I like the timers but the documentation is diabolical.

OGFT

Posted on March 14, 2017 at 08:20

Is there a question?

If yes, please start your own thread and post code.

JW

webmaster
Associate II
Posted on July 05, 2017 at 21:18

Hi Clive

I need your help. In the previous example it works correctly, but for it to work I have to put a breakpoint in my debugger, and then continue. No debugger no ST-Link does not work. Do not start DMA.

Thanks in advance and greetings