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.

TMS320F28069M: about change of USER_NUM_PWM_TICKS_PER_ISR_TICK param

Part Number: TMS320F28069M

Hi all,

Is it OK to change USER_NUM_PWM_TICKS_PER_ISR_TICK from "2" to "3" during program execution?

My customer stops PWM with HAL_disablePwm () during program execution and then restart PWM with HAL_enablePwm (),

somehow the PWM trip occurs and PWM stops.


At restart, if USER_NUM_PWM_TICKS_PER_ISR_TICK is "2", the PWM trip will not occur.

However, since ISR overflows in "2", My customer want to change USER_NUM_PWM_TICKS_PER_ISR_TICK  to "3" immediately after restart.

My customer's project is based on lab13b.

Best regards,

Sasaki

  • Additional information.

    If USER_NUM_PWM_TICKS_PER_ISR_TICK is 2, it seems that an error( pwm trip ) rarely occurs.

    If the value is 1, no error occurs.

    OK : USER_NUM_PWM_TICKS_PER_ISR_TICK (1) <--No error occurs
    NG : USER_NUM_PWM_TICKS_PER_ISR_TICK (2) <--Sometimes an error occurs
    NG : USER_NUM_PWM_TICKS_PER_ISR_TICK (3) <--Always an error occurs

    What is the cause of the error when increasing this parameter?

    Best regards,

    Sasaki

  • If you stop and restart the PWM using HAL_disable/enablePWM, the current control PIDs are still running and will saturate to their maximum/minimum value. I expect this to cause an overcurrent trip when re-enabling the PWM.
    I would suggest stopping and restarting the motor using gMotorVars.Flag_run_identify as intended. That way, the PID current controllers will not saturate.
    The USER_NUM_PWM_TICKS_PER_ISR_TICK is not something you would change at runtime. The USER_NUM_PWM_TICKS_PER_ISR_TICK is a factor in the PID parameter scaling. If you change this and keep the same Kp_Idq/Ki_Idq values the same, you are changing the effective PID parameters. I suspect this is the reason why you see different behavior at 1, 2 and 3 PWM ticks per ISR.
  • Hi Rob-san,

    Thank you for your special support!!

    I will check it.

    Best regards,

    Sasakki

  • In default projects, there are many parameters depend on USER_NUM_PWM_TICKS_PER_ISR_TICK, especially the controller frequency and interrupt frequency. You need to change all the parameters related to USER_NUM_PWM_TICKS_PER_ISR_TICK in the user.h, and then call ENC_setup(), USER_setParams(), CTRL_setParams(), and CTRL_setUserMotorParams() to reset the controller parameters, otherwise the estimated angle and speed is not correct, the motor will be over current and can't run well.

    It maybe not a good idea to change the USER_NUM_PWM_TICKS_PER_ISR_TICK during the code is executing, only if the controller frequency and interrupt frequency are not related to the USER_NUM_PWM_TICKS_PER_ISR_TICK .

  • Hi Yanming-san,

    Thank you for your information!

    The customer decided not to change USER_NUM_PWM_TICKS_PER_ISR_TICK.

    Thanks & regards,

    Sasaki