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.

TMS320F28388S: The HRPWM delay is different from what I expected.

Genius 3215 points

Part Number: TMS320F28388S

Tool/software:

Hi All,

The HRPWM operation is different from what I expected, so I want to know the cause.
The PWM settings are as follows.
・Count mode: Up-down count
・HRPWM application target: Falling edge
・HRPWM mode: Edge mode
・MEP scale factor: 64
・TBCLK: 100MHz (10ns)
・CMPAHR: 255 (8-bit left shift applied)

Given that the MEP scale factor is 64 and TBCLK is 10ns, I had expected that increasing the CMPAHR value by 1 would result in a delay of approximately 156ps,
and that the setting value of 255 would cause a delay of about 40ns.
However, when measured with an oscilloscope, the actual delay was only approximately 10ns, which is about one-fourth of the expected value.
Please explain the cause of this.
Is this behaviour acceptable?

Best Regards,

Ito

  • Hi Ito,

    I would highly suggest first to start from one of our existing HRPWM examples using up-down count with HR duty control.

    Regarding your specific query here are my suggestions.

    Since you are in up-down count mode, and only controlling one of the edges (falling edge) here are some debugging steps you can do to see what the issue may be.

    1. If you're using the SFO library (which I assume you are since you have the MEP Scale factor) ensure that the AUTOCONV bit is set
    2. Ensure you're loading the CMPA on ZRO and PERIOD.
    3. Seems you have already configured the duty to control only the falling edge which is good.

    Some more context. Since your MEP scale factor is 64, this means that the SFO library calculated that there are only 64 actual micro steps possible to be placed within 1 TBCLK due to PTV (process, temperature, voltage). If AUTCONV is enabled, the hardware will automatically convert the value that is being written to the HR portion (0-255 value) to the actual micro step being applied.

    So for 1 microstep of 156ps that would require a CMPAHR value of 4.  

    HR Value Scale Factor Actual MEP Step
    0 64 =(0/255)*64 = 0
    1 64 =(1/255)*64 = 0.25
    2 64 =(2/255)*64 = 0.5
    3 64 =(3/255)*64 = 0.75
    4 64 =(4/255)*64 = 1
    ...
    255 64 64

    Best regards,

    Ryan Ma

  • Hi Ryan Ma,

    Thank you for your help.

    By disabling AUTOCONV, we confirmed that it operates at approximately 156 ps, which is a value divided by 64 for TBCLK relative to CMPAHR:1.

    I have one question. I have confirmed in the data sheet that the standard value for MEP is 150 ps, but
    I did not expect that it could be set to a finer degree than that.

    Regarding Auto Conversion, I understood it to be a function where the hardware automatically sets high-resolution registers such as CMPAHR and TBPHSHR, eliminating the need for software-based calculations or shift processing.
    Therefore, I believed it would not significantly impact precision.

    If there are any clear materials or documentation regarding Auto Conversion, I would appreciate it if you could share them with me.

    Best Regards,

    Ito

  • Hi K.Z.,

    If there are any clear materials or documentation regarding Auto Conversion, I would appreciate it if you could share them with me.

    The TRM section on AUTOCONV would be the documentation we have on this feature and more details can be found in the HRPWM section or the ePWM chatper. In simplicity AUTOCONV works in conjunction with SFO library. I would highly suggest you have both in your application code when you're using HR. I will go ahead and close this thread now.

    Best regards,

    Ryan Ma