Skip to main content
Ranjeet Singh
Senior
March 17, 2023
Question

how to get 50 % duty cycle with complementry pulse

  • March 17, 2023
  • 14 replies
  • 5954 views

i want to generate 50 % duty cycle at freuency (100khz-200 KHz), but i am not getting 50% , i am getting 33-34% duty cycle.this duty cycle change when the frequency change.0693W00000aJBYaQAO.jpg0693W00000aJBZsQAO.png0693W00000aJBZTQA4.png0693W00000aJBMOQA4.png

This topic has been closed for replies.

14 replies

Tesla DeLorean
Guru
March 17, 2023

Show the functions initializing the timer.

Is the frequency as expected?

ARR = N - 1

CCR1 = N / 2

F​rom the scope screen it's hard to see the cycles, or if they are complementary.

Show all registers in TIM1

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Ranjeet Singh
Senior
March 17, 2023

YES ,Frequency is same as expected

Ranjeet Singh
Senior
March 17, 2023

0693W00000aJBoOQAW.png0693W00000aJBnfQAG.png

Ranjeet Singh
Senior
March 17, 2023

ARR = N - 1

CCR1 = N / 2

for this parameter

ARR = 150-1

CCR1 = 150/ 2

Ranjeet Singh
Senior
March 17, 2023

0693W00000aJBoxQAG.jpg0693W00000aJBp7QAG.jpg

Ranjeet Singh
Senior
March 17, 2023

i am using the stm32 g0b1re Microcontroller Board

Ranjeet Singh
Senior
March 17, 2023

if i will use the same parametere at 1KHz frequency then i will got the 50% duty cycle.

time clock -64Mhz

prescale-64-1.

so i will get frequency 64/64= 1 Mhz.

and using ARR value = 100

frequency =1M/100= 10 KHz

CRR=50

duty cycle= (50*100)/100= 50 % duty

but when

prescale-1.

and using ARR value = 100

frequency = 317KHz

CRR=50

duty cycle= 25 % duty

using crr =50 and arr 100 why not duty cycle become 50n%?

Ranjeet Singh
Senior
March 17, 2023

what i m doing wrong ?

AScha.3
Super User
March 17, 2023

not wrong, but maybe there is some deadtime active.

timer -> complementary outputs = usually need deadtime .

try setting it very short.

+ set timerclk 64M , no prescaler.

for 10khz out -> arr 6400 , 300khz out -> 210 .

If you feel a post has answered your question, please click on " Best Answer ".
Ranjeet Singh
Senior
March 17, 2023

yes ,thank you ,its done i have got 50 %

AScha.3
Super User
March 21, 2023

Great!

When your question is answered, please mark this topic as answered by choosing Select as Best for the preferred answer, as also explained here. This will help other users find that answer faster.

If you feel a post has answered your question, please click on " Best Answer ".
Ranjeet Singh
Senior
April 8, 2023

i am using frequency (211Khz to 103Khz ) for inverter mosfet (STF24N60M2) FOR 1.2kw eV Chareger. in this project my duty cycle not maintain at 50% because i am using deadband .i want to maintain duty cycle same as it is for 211KHz same for 103Khz ,what minimum value of deadband i can putt ?,so that duty cycel will same and do not get short MOsfet ( deadband mandatory for mosfet EV circuit )