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.

How can I limit the minimum PWM pulse width in InstaSPIN-Motion?

Other Parts Discussed in Thread: MOTORWARE

Hello,

I try to run the InstaSPIN-Motion on my own board with F28069M.

I find that sometimes the PWM pulse is too short for the MOSFET to switch on/off completely as following picture. Is there any method that I can limit the minimum the PWM pulse width?

Thank you very much.

Best Regards.

  • Hi Jason,

    You could modify HAL_writePwmData() in hal.h to set a MIN PWM duty cycle.

    Jeff

  • Hi Jeff,

    Thank you for your response.

    If one of three phase PWM duty cycle is below the MIN value, should I adjust only the phase duty cycle or all of the three phase duty cycle?

    Best Regards.
  • Hi Jason,

    Do you need to achieve a modulation index greater than or equal to 1, or are you content to stay below 1?

    -Dave

     

  • Hello Dave,

    Sorry I am not quite understand the mean of modulation index. Could you please give me some detail explanation?

    I mean the if the phase a duty cycle is below MIN value, I add a compensation to adjust the duty cycle to MIN in HAL_writePwmData. Should I also add this compensation to phase B and C even if the phase B and C duty cycle is above the MIN value?

    Best Regards.
  • Hi Jason,

    Yes, you could limit your pulsewidth as Jeff suggested in HAL_writePwmData.  Specifically, you would change the 0.5 and -0.5 limits in the following statement:

    for(cnt=0;cnt<3;cnt++)

    {

    pwm = (PWM_Obj *)obj->pwmHandle[cnt];

    period = (_iq)pwm->TBPRD;

    pwmData_neg = _IQmpy(pPwmData->Tabc.value[cnt],_IQ(-1.0));

    pwmData_sat = _IQsat(pwmData_neg,_IQ(0.5),_IQ(-0.5));

    pwmData_sat_dc = pwmData_sat + _IQ(0.5);

    value = _IQmpy(pwmData_sat_dc, period);

    value_sat = (uint16_t)_IQsat(value, period, _IQ(0.0));

    // write the PWM data

    PWM_write_CmpA(obj->pwmHandle[cnt],value_sat);

    }

    My question is, do you ever want to go faster?  InstaSPIN supports an overmodulation feature which involves saturation at 100% and 0% PWM values.  So if you choose to use this feature, you would want to implement a system which eliminated a pulse width below a certain value which you specify, but when you overmodulate, it would jump over this pulse width and go to 100%.

    Regards,

    Dave

     

     

  • Hello Dave,

    Thank you very much for your response.

    pwmData_sat = _IQsat(pwmData_neg,_IQ(0.5),_IQ(-0.5));

    Does this sentence mean limit the PWM duty cycle to 50%? It seems the duty cycle limit is too width.

    Is my understanding right?

    Best Regards.
  • Hi Jason,

     

    No, this does not limit your PWM duty cycle to 50%.  Recall that InstaSPIN uses normalized, or per-unit (PU) representation of many of its variables.  The total PWM range is 0 to 1, where 0 is 0% PWM, and 1 is 100% PWM.  But since the modulation voltages from the code are bipolar, the range is shifted to be from -0.5 to 0.5.

    Also, since my posting yesterday, I talked to another individual who is much closer to this code segment than I am.  He suggested an alternate way to prevent small PWM pulses, either positive or negative.  Later in the code you will see this statement:

    value_sat = (uint16_t)_IQsat(value, period, _IQ(0.0));

    This statement calculates the actual PWM values which are scaled to the period.  So to limit the high PWM values, simply change the value of "period" to a slightly lesser value.  To limit the low PWM values, simply change the value of "_IQ(0.0)" to a slightly greater value.

    However, my question to you is the same.  Do you ever want to use overmodulation?  If so, you probably want to override this limitation, or you will get a minimum pulse width every PWM period, which will increase switching losses.

    Regards,

    Dave

     

     

  • Hello Dave,

    Many thanks.

    Dave (Wisconsin) Wilson said:
    No, this does not limit your PWM duty cycle to 50%.  Recall that InstaSPIN uses normalized, or per-unit (PU) representation of many of its variables.  The total PWM range is 0 to 1, where 0 is 0% PWM, and 1 is 100% PWM.  But since the modulation voltages from the code are bipolar, the range is shifted to be from -0.5 to 0.5.

    My understanding is a bit different regarding following code, let me take a example:

    period = (_iq)pwm->TBPRD;
    pwmData_neg = _IQmpy(pPwmData->Tabc.value[cnt],_IQ(-1.0));
    pwmData_sat = _IQsat(pwmData_neg,_IQ(0.5),_IQ(-0.5));
    pwmData_sat_dc = pwmData_sat + _IQ(0.5);
    value = _IQmpy(pwmData_sat_dc, period);
    value_sat = (uint16_t)_IQsat(value, period, _IQ(0.0));


    period = 999, pPwmData->Tabc.value[cnt]=0.82,
    pwmData_neg=-0.82
    pwmData_sat=-0.5
    pwmData_sat_dc=0
    value=0, value_sat =0

    Seems the result is not as my aspect. Do you have any idea?

    For your question: sure, I want to add the over modulation into my project in next step because current I am not quite understand lab10a. First I want the motor rotate successfully.

    Best Regards.

     

  • Hi Jason,
    That's interesting that you get a value for Tabc.value[cnt] of 0.82. That certainly exceeds the -0.5 to 0.5 limit. Please stand by while I run some tests from my end to see why you are getting a value like this. We changed the voltage scaling from MotorWare14 to MotoWare15, and I suspect this may be causing some issues.
    -Dave
  • By the way, which version of MotorWare are you using?
  • I use motorware_1_01_00_15.