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.

ROM_PWMPulseWidthSet at 0% duty cycle

Hello,

Has anyone seen an issue where 0% duty cycle passed into the ROM_PWMPulseWidthSet function does not shut down the channel completely - I get a 0.2% duty cycle on the channel?

typedef struct
{
    SINT16 frequency; //!< desired frequency in Hz
    SINT32 frequency_icr; //!< desired frequency in ICR counts
    SINT32 OCR_duty_cycle_base; //!< Output Compare Register value to obtain duty cycle value
    SINT32 duty_cycle; //!< see above
} PWM_PROPERTIES_S;

PWM_PROPERTIES_S pwmProperties[PWM_NUM_CHANNELS];


temp = pwmProperties[pwmID].frequency_icr; //400Hz in ICR counts
temp *= pwmProperties[pwmID].duty_cycle; //0% 
temp /= 100;

pwmProperties[pwmID].OCR_duty_cycle_base = temp;

//PWM OUTPUT
ROM_PWMPulseWidthSet (PWM0_BASE, PWM_OUT_0, pwmProperties[pwmID].OCR_duty_cycle_base);

  • Hello KM01,

    0% DC is not possible on the TM4C device PWM. If you want to have 0% DC, then the PWM output has to be disabled.

    Regards
    Amit
  • May I note (further) that this limitation @ EXTREME PWM Duty Cycles appears NOT Limited to just this vendor - we've seen this condition @ (at least) 3 other ARM MCU vendors.

    Your code should (know) when 0% PWM Duty is being attempted - and you can either: disable PWM - as Amit suggests - or you can clamp down the PWM output - via an independent GPIO output. (after feeding the PWM signal thru an appropriate R - and then driving the non-PWM side of that R to ground.

    As hinted - this effect intrudes again at/around 100% duty - and may be handled via a similar, GPIO signal "over-ride."
  • Nor is it limited to ARM micros, but not all micros suffer from this limitation. If you really need both 0% and 100% properly synchronized with the PWM transitions you will have to look at the data sheets and user manuals for particular devices closely to see if it is supported.

    Most times changing the pin configuration to an output is sufficient.

    It's also worth noting that if you are driving power electronics narrow pulses of either type should be avoided

    Robert
  • And - along w/avoidance of, "narrowly pulsing power electronics" - such narrow power pulsing often proves destructive.

    While "changing pin configuration" may work - the transition between such change may also yield "danger."