Loading...
 
Skip to main content

System Workbench for STM32


PWM with first pulse different

Hello everyone,
I am just new to stm32 microcontroller. I am starting my first project of stm32 using "STM32F030C6T6" MCU. My project is to drive a "high speed solenoid valve driver".
In which I have to drive a mosfet with PWM of duty cycle 15%@40Khz. Till this point it is not a problem. but there is a twist that first pulse of PWM output must be of 500ms period i.e. 2Hz with approx. 80% duty cycle means 80%@2Hz. From 2nd pulse it should be then 15%@40Khz
Just Summarizing here:

__1st pulse : Freq. 2Hz, Period 500ms, duty cycle appr. 99%
2nd pulse: Freq. 40Hz, Period .025ms, duty cycle appr. 15%
3rd pulse: Freq. 40Hz, Period .025ms, duty cycle appr. 15%
|
|
|
last pulse: Freq. 40Hz, Period .025ms, duty cycle appr. 15%

Note: Toff of all pulse from first to last should be same.__

Can any one help me how it can be done with timer or how to configure timer for it.
You feedback and suggestions will be highly appreciated.
Thanks in advance.

 
Collapse/expand modules below