This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS1224: Dead band generating weird additional pulse

Part Number: TMS570LS1224
Other Parts Discussed in Thread: TMS320F28035, HALCOGEN,

Hello, I've been using PWM for driving BLDC motor for quiet some time and during testing I've noticed some strange behavior.  

I have detected where is the casue, I would like to know why its happening.

(note:  pwm_u is  EPwm4Regs,  pwm_v is EPwm7Regs and pwm_w is EPwm5Regs

PWM is set at 20kHz freqency using Up-down mode, so far all changes in PWM periphery had same results)

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
/* Basic PWM periphery settings */
pwm_u->TBPRD = 2000; // Period = 4001 TBCLK counts (20 kHz)
pwm_u->TBPHS.half.TBPHS = 0; // Set Phase register to zero
pwm_u->TBCTL.bit.CTRMODE = TB_COUNT_UPDOWN; // Symmetrical mode
pwm_u->TBCTL.bit.PHSEN = TB_DISABLE; // Phase loading disabled
pwm_u->TBCTL.bit.PRDLD = TB_SHADOW;
pwm_u->TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // Sync down-stream module
pwm_u->CMPCTL.bit.SHDWAMODE = CC_SHADOW;
pwm_u->CMPCTL.bit.SHDWBMODE = CC_SHADOW;
pwm_u->CMPCTL.bit.LOADAMODE = CC_CTR_ZERO; // load on CTR=Zero
pwm_u->CMPCTL.bit.LOADBMODE = CC_CTR_ZERO; // load on CTR=Zero
pwm_u->AQCTLA.bit.CAU = AQ_SET; // set actions for EPWM4A
pwm_u->AQCTLA.bit.CAD = AQ_CLEAR;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

This is called inside interrupt to change which of PWM outputs should modulate :

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* To prevent unintentional transistor short-circuit during force event */
pwm_u->DBCTL.bit.OUT_MODE = OUT_DISABLED; // 0 - Disable Dead Band for output A
pwm_v->DBCTL.bit.OUT_MODE = OUT_DISABLED; // 0 - Disable Dead Band for output A
pwm_w->DBCTL.bit.OUT_MODE = OUT_DISABLED; // 0 - Disable Dead Band for output A
/* Main part */
pwm_u->aqcsfrc.reg_value.csfa = PWM_AQ_SWF_NONE; // enable PWM on A output
pwm_u->aqcsfrc.reg_value.csfb = PWM_AQ_SWF_LO;
pwm_v->aqcsfrc.reg_value.csfa = PWM_AQ_SWF_LO;
pwm_v->aqcsfrc.reg_value.csfb = PWM_AQ_SWF_HI;
pwm_w->aqcsfrc.reg_value.csfa = PWM_AQ_SWF_LO;
pwm_w->aqcsfrc.reg_value.csfb = PWM_AQ_SWF_LO;
pwm_u->DBCTL.bit.HALFCYCLE = ENABLED; // 1
pwm_u->DBCTL.bit.IN_MODE = IN_MODE_RA_FA; // 0 - source for both falling-edge and rising-edge
pwm_u->DBCTL.bit.POLSEL = ACTIVE_HI_COMP; // 2 - Active High Complementary (B is inverted)
pwm_u->DBCTL.bit.OUT_MODE = PWM_DB_OUT_FULL_ENABLE; // 3 - Enable Dead Band for both outputs
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

And this is result: 

The main problem causing glitch is ironically in part, which is suppose to prevent this kind of things (from my point of view) and that is disabling dead band before forcing Action-Qualifier.

Now another strange thing is that when I am increasing duty cycle ( above 35 % ) the pulse on channel B is long (they are overlaping).

Over 50% duty the complementary pulse is working and behave as it should which is weird :

So now to my question. When I remove line which is disabling DBCTL on phase U (ePWM4A) then complementary channel B starts working properly in every duty (not only above 50%).

Can someone explain to me why is this happening? Why cannot I safely first disable dead band and couple of instructions later turn it on without getting weird glitch?

Also I have been using TMS320F28035 with same settings of PWM and same code(with of course some minor changes due to the fact its different processor) and that thing didnt occur there.

  • Hi Youda,

    Can you please share a sample project with the issue you are saying?

    It would really helpful us to easily trigger the issue at our end, so that we can debug and provide necessary solution.

    --

    Thanks & regards,
    Jagadish.

  • Hello, sorry for delay, it was vacation time :), anyway here I reproduced problem using HALcogen and using HAL libraries and tested it on Hercules TMS570LS12x/RM46 LaunchPad.

    Here is sample code so you can try and maybe tell me right away why there is glitch at low duty (below 15% duty). ( I added comments to "sys_main.c" part of code causing the glitch:

    .PWM_glitch.zip

    Best regards.

  • Hi Youda,

    I am out of office till this Monday, please expect some delay for further updates on this issue.

    --

    Thanks & regards,
    Jagadish.

  • Of course no problem,

    I just want to add that after flash my code to launchpad the glitch can be observed via oscilloscope or logic analyzer on PWM4 ( header J11 ---> pin 26 and pin 27 on TMS570LS12x launchpad )

    Best regards.

  • Hi Youda,

    I don't have this TMS570LS12x board, so i am just recreating your example project with RM46x. I am done with the project and i have to get a logic analyzer to test it.

    I will test it and will provide an update ASAP.

    --

    Thanks & regards,
    Jagadish.

  • Hi Youda,

    I just tried your project on RM46x but the i can't see any PWM on logic analyzer. Still i am working on to generate the waveforms.

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    I'm not sure how did you recreated to RM46x because I used Halcogen for periphery settings but you can check my .dil file for Halcogen settings of periphery for TMS570LS1224 ( pay attention to PINMUX, ETPWM and ADC1 settings, since I use special pinmuxing [ADC trigger option B] ). 

    PWM_glitch_test_halcogen.zip

  • Hi Youda,

    Apologies for the delay in my response!

    I recreated your project on RM46 and tested.

    Here is my project:
    PWM_Glitch_Issue_RM46.zip

    And here is the logic analyzer waveforms of PWM4A and PWM4B:
    Glitch_Test_RM46.sal

    And i don't see the glitch you are talking about, 

    and i want to know the following things from you:

    How frequently you are getting this glitch?

    And Is it occurring for only PWM4A and PWM4B or any other PWM's also?

    --

    Thanks & regards,
    Jagadish.

  • Hi Jagadish,

    I checked your code and you recreated it differently than I use it.

    For example you dont call function "adc_eoc_update_pwm" anywhere in your code and thats the main function where you can observe glitch. In my code it is used in module adc.c in end-of-cycle eoc interrupt "adc1Group0Interrupt" (trigerred by 20kHz PWM), so it is called every 50us.

    All three PWMs (4,7 and 5) have this glitch always when I try to disable dead band first.

    I didnt study settings of your PWm periphery but from my geuss you dont changed dead band settings during interrupt so maybe thats why you dont see any problem.

    Best regards.

  • Apologies for the delay in the response.

    I am stuck with other issues, thanks for providing more details.

    I will again try to recreate the issue by tomorrow.

  • Hi Youda,

    I could see the glitch you are saying, i am analyzing the waveform now and will try to provide an update by tomorrow.

  • Hi Jagadish,

    ok, so it is also on RM46, well now I am looking forward for explanation what may cause this.

  • Hi Youda,

    I understood what is happening and why you are getting that extra glitch in the waveform.

    To understand this i did 3 captures.

    1. Without out deadband:

    I just commented out the calling of the function "adc_eoc_update_pwm" in adc1Group0Interrupt and captured the waveform and here is the output.

    You can consider this is the waveform if no deadband present, i mean deadband bypassed completely .Remember that we are getting complete low on PWM_B if we bypassed the deadband.

    2. Deadband but without disable:

    In this case i am calling the function "adc_eoc_update_pwm" but i commented the line "etpwmDisableDeadband" in this function.

    And in this case our pulse width got reduced due to the delays we configured and in this case we are seeing invert output on PWM_B because of the Invert configuration we made.

    3. Deadband with disable:

    In this case nothing commented and you already knew this waveform

    Now coming to the explanation:

    Actually the 3rd screenshot is the combination of 1and 2, i mean if you disable the deadband by writing 0x00 to the DBCTL register it will just bypass the deadband completely, so if you disable the deadband means you will get the waveform in the capture_1(that is completely low for PWM_B).

    For your better understanding, i just zoom the waveform and explained different edge points.

    I think this will clarify your doubts.

    --
    Thanks & regards,
    Jagadish.