Skip to main content
arre24
Associate
August 22, 2012
Question

Variable frequency pulse train for pulse transformer application

  • August 22, 2012
  • 53 replies
  • 8009 views
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?
    This topic has been closed for replies.

    53 replies

    Garnett.Robert
    Senior III
    March 14, 2017
    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

    waclawek.jan
    Super User
    March 14, 2017
    Posted on March 14, 2017 at 08:20

    Is there a question?

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

    JW

    webmaster
    Visitor II
    July 5, 2017
    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