Skip to main content
honza
Associate
July 12, 2012
Question

Generating single pulse on GPIO pin

  • July 12, 2012
  • 11 replies
  • 4649 views
Posted on July 12, 2012 at 11:25

I want to generate single pulse with given length on GPIO pin on STM32F4 Discovery kit. I wanted to use timer in OnePulse mode. So I was planning to use TIM4 and TIM12, becouse I need 6 independent pins for pulses. But I am a little confused from the example in Standard Peripherals Library. There's used a timer as a trigger for pulse. But I want to trigger pulse from my code, not from timer. How can I do that?

I want to have function like this: void GeneratePulse(uint8_t pin, uint16_t duration). How should I configure timer to get this kind of behaviour?

Thanks in advance.
    This topic has been closed for replies.

    11 replies

    arnold_w
    Senior II
    August 14, 2015
    Posted on August 14, 2015 at 09:37

    On another forum (

    http://www.mikrocontroller.net/topic/343940

    ) they recommend that the timer is started manually:

    TIM3->CR1 |= TIM_CR1_CEN; // Start Timer 3

    However, I tried that and it still doesn't work.