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.

TMS320F28379D: Questions about hrpwm_duty_sfo_v8

Part Number: TMS320F28379D

Tool/software:

Hello,

     Good day!

     The customer have confusion about the answer in ticket below:

      TMS320F28379D: Usage information on TRREM register for periodic HR phase update - C2000 microcontrollers forum - C2000Tm︎ microcontrollers - TI E2E support forums

      

      The customer can not get the function principle.     

     The image below represents the customer's  understanding.

     

     Assuming PRD is 96.6, then TBPRD=96, TBPRDHR=0.6, and PWM2 leads PWM1 by 90°. According to my understanding, EPwm2Regs.TBPHS.bit.TBPHS=48 and EPwm2Regs.TBPHS.bit.TBPHSHR=0.3.

     According to the formula in Figure 1, EPwm2Regs.TBPHS.bit.TBPHSHR = 1-0.3=0.7. 

     Could you help to clarify? Thank you so much.

  • Hello,

    If it leads by 90 deg then TBPHS will be 0.25 x TBPRD, so 24. and for TBPHSHR it is correct. If it is leading phase shift, then you would calculate HR values like in E2E above.

  • Hello Stevan,

         Thanks for your support.

         The customer has confusion still, could you help to clarify further ? Thank you so much.

         " 2. For PHSDIR = 1, negative phase values: the desired value need to be subtracted from 0xFF (this will be added to the TRM)

    Example: EPwm2Regs.TBPHS.bit.TBPHSHR = (Uint16)((0xFF - ((Uint16)total_phase >> 8)) << 8);

    When HRPE=1 use TRREM."

    ---- I can not get what is meaning . 

    For the two PWMs: PWM1 and PWM2, the period and duty cycle are the same, with a count of TBPRD = 360, TBPRDHR = 0x7F<<8; for PWM2: PHSDIR = 1.Now to make PWM2 lead PWM1 by 90 degrees, set EPwm2Regs.TBPHS.bit.TBPHS=180, TBPHSHR = 0x3F<<8.

    As shown in the figure above, TBPHSHR=TBPRDHR /2 calculates PWM2 leading PWM1 by 90°.

    So why use the formula TBPHSHR = ((0xFF - (TBPRDHR >> 8)) << 8)?

         

  • Hello,
    Good day!
    Please update here if you have any suggestion, thank you so much.

  • Hello Alice,

    You could do that to obtain TBPHS register, but for TBPHSHR you cannot do that. Essentially, when you divide you would get integer value of TBPHS and the decimal remainder is TBPHSHR value. TBPHSR is a delay value that shifts edge always to the right (lagging waveform). So, if your TBPHS is producing leading waveform you would need to express TBPHSHR as 1 - actual delay to convert it properly. 

    If you use TBPRDHR you would need to use TRREM register instead. Please refer to TRM to check TRREM register configuration. Hope this helps.