PWM with Dedtime input

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        Hii all, i Need ur help to implement my Task. I am working with PSoC5LP. I have to implement H-Bridge for MOSFET with deadtime input. pls check the attached file for deadtime inpuzt & Output. I know i Need clock & Counter but the Problem is i don't understand how can i connect it in design. pls help me for this. Regards Shveta   
0 Likes
28 Replies
Anonymous
Not applicable

@Shveta

   
    Assume someone who doesn’t know about your project. Do you give enough information?   
   
    These are a few that you need to specify:   
   
     1.       What is the input? Does it from an analog input pin (most likely)? Or key in via keyboard? Or receive from serial interface?   
   
     2.       What is x? Is this the dead time?   
   
     3.       What is “output”? What are the units?   
   
     4.       What is the frequency of the pulse output? Is this a fix frequency or a fix period?   
   
     5.       Is the dead time linearly controlled by the input? I.e. if input is 0.6V what should be the dead time and the “output”?   
   
     6.       How fine you want the control of dead time to be? i.e., what is the resolution of the dead time?   
   
     7.       How fine you want the “output” to be?   
   
     8.       How fine is your input? In 0.1V steps, or 0.001V steps?   
   
     9.       What are the values of X and “output” when input is lower than 0.5V and higher then 3.25V?   
   
     10.   If you are controlling the dead time, you are also changing the duty cycle of the output pulse, is this you want?   
   
     11.   Do you want to indicate the value of input using some kind of display?   
0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

HL, many of the answers for you here - www.cypress.com/

0 Likes
Anonymous
Not applicable

Shveta is starting a new thread as suggested, but still need the followings

   

1) Detailed specs

   

2) Drawing of overall application, by block or schematic, what you are driving externally

   

3) All relationships, eg. expected waveform vs V, described in math

   

4) Detailed timing diagram of desired waveforms

   

Besides that, some times it helps to review what we know/don't know to move forward

0 Likes
Anonymous
Not applicable
        @HL heree i try to answerur questions. 1. Analog input pin as Input. 2. Yes x is deadtime. 3. In PSoC PWM component Deadband 2-256 cycle & I have value from 2 to 24. But I don’t know the unit. 4. I have fixed freq. & for period I need 40ns step. 5. I have input from 0,5 to 3,25 & I need deadtime output from 4 to 24. So I just divide the possible input to the possible output. So if 0,6v the output will be either 4 or 5. 6. I use 16-bit ADC & 16-bit PWM. So I think deadtime resolution is also 16-bit..? 7. Don’t know. 8. 0,01v Steps 9. If input lower than 0,5v then deadtime = 4 & higher then 3,25v then deadtime = 24. 10. Yes, I want to change the Duty cycle as the deadtime changes. 11. Yes with LCD. The deadtime is totally new for me.So i m much more confuse. pls help me Regards Shveta   
0 Likes
Anonymous
Not applicable
     1.       Ok   
   
     2.       Ok   
   
     3.       What is your requirement in pS, nS or uS, don’t assume you use the PSoC PWM yet, once we know the requirement, we can convert back to the cycles of PWM.   
   
     4.       What is the frequency? If you have fix frequency, what is the 40nS for?   
   
     5.       Dead time of 4 to 24 pS, nS, uS or mS? If it is ok to have 4 or 5 when input is 0.6V then why you need to use 16bit ADC.   
   
     6.       What do you need? What is the requirement?   
   
     7.       This affects your design, you have to ask for this.   
   
     8.       See 5.   
   
     9.       Ok   
   
     10.   Ok.   
   
    11. OK   
   
    It would be better if you tell us the original requirement/specification!   
   
    After this, how about give us the drawing, blocks or schematic and external circuit. that you already designed.   
   

Have you read any information about deadtime and what it is for and why it is needed? So you would understand more about your project.

0 Likes
Anonymous
Not applicable
        @HL I have to set Deadtime with 40nS. For frequency i have another Analog Input pin. I read abt deadtime. I know theoratically what is it, why Need it. But the Problem is what i Need to program it. Regards Shveta   
0 Likes
Anonymous
Not applicable

1, Do you mean that you have to set the deadtime in steps of 40ns? ie the dead time (in ns) would be 210, 250,,,  ?and no need to have dead time 220, 230...?

   

2. Do you mean that the frequecy of the Pulse is control by another analog pin? If so what is the range of frequency/period of the output.?

   

3. Do you have a flow chart or pseudo code to show what you have done or how you would write the program? No need to show the PSoC code yet and don't worry about the PSoC APIs yet.

   

4. how is the external hardware/wiring?

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable
        @HL Hello here ist the answers of your questions. 1. ya..I have to set deadtime in steps of 40ns. E.g..210..250... in ns. 2. ya..the range of frequency/period is Min 0,5v -- 250 kHz -- 4us Max 3,25v -- 80 kHz -- 12,5 us 3. pls check the attched document. In flowchart i don't do the "Compute Deadtime" 4. For external wiring i saw output PWM signals on oscilloscope through pin p0.0 p0.1   
0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Not quite easy as I understand: 40ns resolution are a frequency of 25MHz (1 / 40e-09). The clock frequency of a normal speed PSoC is 67MHz but should be set to 50 MHz, this will give the best resolution for 40ns steps.

   

So a value of 10 clock cycles is 200ns, 12 clock cycles give 240ns and so on. When you can live with this error of 10 ns you are fine off.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

@Bob

   

thank u very much bob.

   

But the Problem is how can i implement this in program ?

   

Regards

   

Shveta

0 Likes
Anonymous
Not applicable

 As Bob says. What is the acceptable error of the dead time? ie Xns +-?ns or Xns +-%?

   

Also what is the relationship between the 2nd AD input to the output frequency? Is it a linear relationship to the input ? or the output is in steps, like that of the dead time? also what is the resolution required for the output frquency?

   

Don't jump to the implementation now. let's clarify the requirment first.

0 Likes
Anonymous
Not applicable

@HL

   

Exceptable Error of the deadtime is Xns +-.
1st AD input to give PWM frequency & 2nd to give Deadtime.

   

Each n every inputed frequency i have to give all possible deadtime (from min to max).
So e.g frequency min. input = 0.5v  for 250kHz then from 2nd AD input i set deadtime (from min to max).

   

So i think it's output is in input. We take output value of frequency as input for deadtime. So the output is in Step of the deadtime.

   

Requiered resolution for output frequency is 16bit.

   

Regards

   

Shveta

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Shveta, if it is easier for you to post in German language, I can translate for you.

   

In the table you provided in your first post: What units is the item "Output"?

   

Have there been any additional written instructions you have got?

   

You did not answer the question regarding the required precision of delta x (whatever delta x is)

   

What is delta x???? and what is x when there is a delta there should be at least two of those

   

As you can see is the input in V not linear, there are some "jumps" in it. Since there are only a few entries the easiest solution will be to build two tables that contain the required two values for the PWM: Frequency and delta x. or whatever is needed.

   

The index of the table will be calculated from your input voltage which seems to be in the range of 0.5 to 3.5 Volts. This would prohibit the usage of 3.3V as Vcc for the PSoC 5

   

As you can see there are some thoughts required before starting to program the first statement.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

@Bob
Sorry it was my mistake.

   

Delta x is the value of one single PWM wave with x1=on time & x2 = off time.

   

In table I wrote this value from the Oscilloscope.

   

Regards

   

Shveta

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

So let us discuss the first entry: Input = 0.5V; Ontime - Offtime = 210 ns WHAT IS THE "OUTPUT" = 4 ???

   

or

   

0.5V, OffTime - Ontime = 210ns?

   

 

   

As I tried to show you, the finest granularity is 20ns which signifies that it is impossible to have values like 210. Only 200 or 220 are possible, can you live with that?

   

 

   

Ah, slowly I get it, you have got two channels and the first signal is longer than the second and the second lies completely within the first. Right?

   

 

   

_____|--------------|______

   

_______|--------|_______

   

 

   

Can you sketch what delta x is and what "Output" = 4 is???

   

Bob

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

To help you get acquainted to PWM, drop one onto your schematic window, give it a 50MHz clock and configure it as in the attached picture. Play with the Deadband Clock cycles and watch ph1 and ph2. Is that what you want? Any of ph1 or ph2 need to be inverted before brought out to a pin?

   

 

   

Bob

0 Likes
Anonymous
Not applicable

@Bob hello,

   

I need for 0.5v input, Offtime-Ontime = 200ns.

   

ya..you are right. I have two PWM channels first is longer than the second & the second lies completly within the first.
Instead of 4 take 200ns min deadtime & 1µs max deadtime.

   

ya.. i need it. ph1 has On then Ph2 has Off & vice versa.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

So your problem is solved: You can now buid a table which contains in terms of clock cycles

   

the deadband (2..256 = 40ns..5µs)

   

the period which always has to be greater than 2*deadband

   

When you measure your incoming voltage you only have to classify which of the table entries has to be used.

   

 

   

 

   

Bob

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

@Bob

   

thanks.

   

Is the attched table is right? I have to set Deadtime from 4 to 24. for 2..256 cycles

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

@Bob

   

also check the attched Project which i try for doing this. I know it's much with error..but u can suggest me.

   

Regards

   

Shveta

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The PWM_Start() will override your settings you have done before

   

The comments for period and clock do not follow what you have set in reality

   

You do not change yet the dead-time value or period

   

 

   

Bob

0 Likes
Anonymous
Not applicable

To get the value of the dead time you can

   
     1.       Use a table   
   
    Create an array DEADTIME_ARRAY[] with the range of output.   
   
    Read the value with the input as an index to the array.   
   
     DEADTIME_OP =  DEADTIME_ARRAY[index]     
   
        
   
     2.       Use if else if..   
   
    If (volt <V1)   
   
    {   
   
                     DEAD_TIME = A;   
   
    }   
   
     Else if (volt <V2)   
   
        
   
    {   
   
                     DEAD_TIME = B;   
   
    }   
   
    …..   
   
        
   
        
   
     3.       Use a formula   
   
    /* Range of dead time */   
   
                     Range of dead time = DEAD_TIME_OP_MAX – DEAD_TIME_OP_MIN   
   
    /* range of input */   
   
    Range of input = ADC_DEADTIME_INPUT_MAX - ADC_DEADTIME_INPUT_MIN   
   
    /* calculate the slope */   
   
                     K = Range of dead time/ Range of input   
   
                                     /* The output of deadtime is now   
   
                                                     DEADTIME_OP =k(current  ADC input - ADC_DEADTIME_INPUT_MIN) + DEAD_TIME_OP_MIN   
   
        
0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

@HL

   

Thank u very much.

   

I do exactly what u wrote in ur last post., but it don't Show the right Output.

   

pls check the attched Project.

   

Regards

   

Shveta

   

 @Bob I Change in attached Project.

0 Likes
Anonymous
Not applicable

1. you should only use one of the three methods. not all 3. Pick one to use.

   

2. your program

   

  if(Deadtime_Ans_Old <= 0.5)

   

    { Dead_Time = Deadtime_Array[0]; }

   

  if(Deadtime_Ans_Old <= 0.5 && Deadtime_Ans_Old > 0.7)

   

 { Dead_Time = Deadtime_Array[1]; }

   

can you tell us what the higlited instruction is for? if th input is 0.6V, what would happen?

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

On line 78 you write
                Deadtime_Ans1 =  ADC_DelSig_CountsTo_mVolts( Deadtime_Ans );  // Convert A/D counts to mV equivalents
and later you use this value setting the deadtime

   


                    PWM_1_WriteDeadTime((uint8) Deadtime_Ans1 );        // Update PWM Deadtime value   
 

   

There is no 1:1 relation between the mV and the deadtime. Thus the reason I suggested to use a table, but not on paper, but a table in program

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hello Shveta,

   

sorry for disturbing you. I have the same problem. I want to produce two phase signals with dead band. Could you help me if you have solve the problem?

   

Thanks a lot

   

Regards

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Setup is right in the global properties -

   

 

   

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

Another approach -

   

 

   

    

   

          http://www.cypress.com/?rID=73644

   

 

   

Regards, Dana.

0 Likes