+ Post New Thread
Results 1 to 4 of 4
  1. #1
    Junior Member level 3
    Points: 1,500, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2012
    Posts
    30
    Helped
    0 / 0
    Points
    1,500
    Level
    8

    How to Generate exact number of pulse using stm32

    hi guys
    i am using stm32f429 In my application I need to provide clock input to a AC Servo Drive.
    i must generate a pulse and control frequency and number of pulse. i am going to control frequency from 1Hz to 200KHz (with 1Hz Resulotion) and control number of Pulse between 1 Pulse to 4294967296 Pulse (a 32 bit variable).
    i use timer 1 in pwm mode and one pulse mode using repetetion counter but repetetion counter is only 8 bit and i need 32bit control register to control number of generated pulse.
    please help.
    best regards

    •   AltAdvertisement

        
       

  2. #2
    Super Moderator
    Points: 81,029, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,430
    Helped
    3730 / 3730
    Points
    81,029
    Level
    69

    Re: How to Generate exact number of pulse using stm32

    Hi,

    Why not using a hardware pin as clock input for a hardware counter?.

    On compare match raise an interrupt to stop the PWM.

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  3. #3
    Junior Member level 3
    Points: 1,500, Level: 8
    Achievements:
    7 years registered

    Join Date
    Sep 2012
    Posts
    30
    Helped
    0 / 0
    Points
    1,500
    Level
    8

    Re: How to Generate exact number of pulse using stm32

    Hi
    thanks for answer
    Can you explain more?
    How can i control frequency and number of pulse?



    •   AltAdvertisement

        
       

  4. #4
    Super Moderator
    Points: 81,029, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,430
    Helped
    3730 / 3730
    Points
    81,029
    Level
    69

    Re: How to Generate exact number of pulse using stm32

    Hi,

    Apparently you did not read datasheet, application notes, design examples. Even video tutorials are available for
    * frequency setup for PWM
    * pulse counting with hardware timer/counter periferal.

    Do this first.

    The use code from the examples and modify them for your needs or writethe code on your own.
    Test it
    And if it does not work, then
    * give a link to the document(s)
    * show your code, maybe schematic, too
    * explain what you expect
    * explain what does not work as expected

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



--[[ ]]--